Article View: comp.std.c
Article #2541Re: Is this a bug in Quick C?
From: Doug Gwyn
Date: Mon, 11 Mar 1991 18:26
Date: Mon, 11 Mar 1991 18:26
26 lines
1340 bytes
1340 bytes
In article <s64421.668684042@zeus> s64421@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.
Technical Details
Message-ID:
<15440@smoke.brl.mil>Path:
arc1-ca.pugleaf.net!utzoo!news-server.csri.toronto.edu!cs.utexas.edu!yale!cmcl2!adm!smoke!gwynReferences:
<s64421.668684042@zeus>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!news-server.csri.toronto.edu!cs.utexas.edu!yale!cmcl2!adm!smoke!gwyn From: gwyn@smoke.brl.mil (Doug Gwyn) Newsgroups: comp.std.c Subject: Re: Is this a bug in Quick C? Message-ID: <15440@smoke.brl.mil> Date: 11 Mar 91 18:26:39 GMT References: <s64421.668684042@zeus> Organization: U.S. Army Ballistic Research Laboratory, APG, MD. Lines: 26