Is this a bug in Quick C?
Doug Gwyn
gwyn at smoke.brl.mil
Tue Mar 12 04:26:39 AEST 1991
In article <s64421.668684042 at zeus> s64421 at zeus.usq.EDU.AU (house ron) writes:
>A friend has found that the following program behaves oddly under
>Quick C:
>main()
>{
> int i,j;char c;
> i = scanf("%d%c",&j,&c);
> printf("%d %d %c\n",i,j,c);
>}
It's a miracle that it works at all, in the absence of a prototype for
the variadic functions scanf() and printf(). <stdio.h> should be #included
and the main() function should return a value.
>The idea is to have the newline typed after the number put into c.
>However, Quick C version 2.5 requires that the user type TWO newlines
>before any output is produced.
Assuming that that behavior persists after you change the program to be
strictly conforming to the C standard, it would be an error in the
Quick C implementation, rendering it not standard conforming.
>It is a question of timing, and most language standards are very lax about
>that issue.
It is not at all a matter of timing.
More information about the Comp.std.c
mailing list