Is this a bug in Quick C?

house ron s64421 at zeus.usq.EDU.AU
Mon Mar 11 19:34:02 AEST 1991


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);
}

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.  Earlier versions, and other C compilers
I have tried (Power C, TopSpeed C) produce their output after the
expected one newline.  I know the behaviour of Quick C V2.5 is wierd,
but is it actually ILLEGAL, according to the ANSI C standard?  It is
a question of timing, and most language standards are very lax about
that issue.

--
Regards,

Ron House.   (s64421 at zeus.usq.edu.au)
(By post: Info Tech, U.C.S.Q. Toowoomba. Australia. 4350)



More information about the Comp.std.c mailing list