This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: ANSI C: variable declaration
- From: Brian Dessent <brian at dessent dot net>
- To: kwama <kwama at punkass dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Tue, 20 Feb 2007 23:34:12 -0800
- Subject: Re: ANSI C: variable declaration
- References: <9076181.post@talk.nabble.com>
- Reply-to: gcc-help at gcc dot gnu dot org
[ 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