On May 28, 2014, at 15:19 , Gedare Bloom <ged...@rtems.org> wrote:

>> + It declares new variables in inner scopes which has been avoided
>> in the past. I think this was not supported in older C standards and thus
>> there was no choice but to avoid it. I don't remember when it got added
>> to C. I assume C99 since that is our target language. But we never
>> discussed it.
>> 
> I believe I have seen this creeping into RTEMS recently. The coding
> conventions say to use ANSI C, which is a vague description that could
> mean C99, or C90.

By "declaring variables in inner scopes" are you talking about block scope, 
that is,
int foo(void)
{
/* And then later on... */

        {
                int new_scope_var;
                ...
        }
}
where "new_scope_var" is only in existence in that block?

I think that's been around close to forever and it shouldn't be discouraged.  
Historically macros depend on it, and a coding convention that says "declare a 
variable in as restricted a scope as possible" is a MUCH better convention than 
avoiding new variables in block scope.

Sorry if I misunderstood.

Peter
-----------------
Peter Dufault
HD Associates, Inc.      Software and System Engineering


_______________________________________________
rtems-devel mailing list
rtems-devel@rtems.org
http://www.rtems.org/mailman/listinfo/rtems-devel

Reply via email to