K&R App A, par. 8 & 8.2, on Declarations, Defaulting.

dgary at ecsvax.UUCP dgary at ecsvax.UUCP
Thu Jul 12 01:52:08 AEST 1984


<>
>From: ka at hou3c.UUCP Thu Jul  5 23:59:08 1984
>The statement "a = 1;" should be a valid global declaration.  For
>declarations inside a function, "int a = 1;" should be required.
>				Kenneth Almquist

I agree that "a = 1;" should be a valid global declaration, but see
nothing wrong with it as a local one.  The statements "int a=1;"
"int a; a = 1;" and "a = 1;" should all produce equivalent code!
This is because of the way C handles initialization of automatic
local variables.  The only problem I can see is in letting the
compiler tell where the declarations end and the statements begin.
If you allow this as a valid declaration, that's not a problem.

D Gary Grady
Duke University Computation Center, Durham, NC  27706
(919) 684-4146
USENET:  {decvax,ihnp4,akgua,etc.}!mcnc!ecsvax!dgary



More information about the Comp.lang.c mailing list