This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ANSI C: variable declaration


[ This is not gcc-specific, so you'd be better with a C forum such as
comp.std.c or comp.lang.c. ]

kwama wrote:

> Document number like ISO/IEC 9899:1999 (E)
> Paragraph # x.x.x
> Page #
> Text

You won't find it anywhere in ISO/IEC 9899:1999, because that is C99
which allows this.  You'd need to look at C90 (ISO/IEC 9899:1990) or C89
(ANSI X3.159-1989).  C99 is most definitely not "ANSI C".

In _The C Programming Language, 2nd ed._ (1988) by Kernighan & Ritchie,
page 200 section A.9.3 contains the text:

> So that several statements can be used where one is expected, the 
> compound statement (also called ``block'') is provided. The body of a 
> function definition is a compound statement.
>
> compound-statement:
>  { declaration-list(opt) statement-list(opt) }

This effectively mandates that all declarations precede statements in
every block.

Brian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]