This is the mail archive of the gcc@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: [RFC]: allowing c99 for-loop scope in gnu89?


> We allow using many c99 features in gnu89.  How about for-loop scopes
> and declaring a loop iteration variable in the initialization?  E.g.:
>
 >   for (int i=0; i<4; i++)
 >     printf ("i=%d\n", i);

I don't think it's absolutely necessary. I think that some of the gnu89
extensions are not good ideas.  In general I think that a c99 feature should
be in gnu89 if it really provides a boost: complex numbers, && and computed
goto, designated member initializers all do IMO, while this is not the case
for for-loop scope and interspersed statements and declarations.

Also I'd think twice before enabling an extension in gnu89 if it can be used
by mistake (pasto). For example, a frequent cause of error on non-GCC
compilers is declaring variables in the middle of a block -- you cannot
write variable-sized arrays by mistake, and flexible array members are rare
enough to not be a problem, but I think enabling interspersed statements and
declarations in gnu89 is a bad idea.  Unless you want to provide switches to
disable some particular extension (like -f does for optimizations).

|_  _  _ __
|_)(_)| ),'
------- '---



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