declaring variable
Devin_E_Ben-Hur at cup.portal.com
Devin_E_Ben-Hur at cup.portal.com
Sun Apr 9 11:17:48 AEST 1989
>In article <26707 at tiger.oxy.edu>, Michael Hunter writes:
>| Within this program was a declaration that was similar to:
>| double A,
>| B,
>| fooY,
>| fooX,
>| whelp; /* <--- note this */
>| WhatAmI, /* line 6 */
>| AndMoreVariables;
>|
>| He was compiling his program under TurboC 2.0.The compiler with all warning
>| turned on was not saying anything about the semi after whelp. But It did
>| not appear to be allocating space for the variable..at least in the debugger
>| if there was a line of the form whelp=constant, whelp did not change
>| value.
>
>| Two questions:
>| 1) Why isn't WhatAmI, AndMoreVariables; a syntax error? How does the
>| grammar produce this?
>| 2) What happens on other machines....do most compilers say something
>| and does lint howl?
>
> One answer:
>
> TurboC2.0 is broken in this regard.
>
>--
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>~ David Geary, Boeing Aerospace, Seattle ~
>~ "I wish I lived where it *only* rains 364 days a year" ~
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Horsepucky... here's TurboC 2.0's responce to the above input:
Turbo C Version 2.0 Copyright (c) 1987, 1988 Borland International
t.c:
Error t.c 6: Declaration needs type or storage class
*** 1 errors in Compile ***
Available memory 393548
The original poster is either blind or the variables WhatAmI, AndMoreVariables
are actually declared names (outside of the scope of the posted fragment)
such that: WhatAmI, AndMoreVariables;
parses as a C comma operator statement: <expr>, <expr> ;
Devin_Ben-Hur at Cup.Portal.Com
...ucbvax!sun!portal!cup.portal.com!devin_ben-hur
More information about the Comp.lang.c
mailing list