On May 29, 2014, at 17:47 , Gedare Bloom <ged...@rtems.org> wrote:

> You understood precisely. I think it was not permitted in C90 perhaps?
> We should revisit it, but I think historically all variables are
> declared at the top of the function.

I'll dig up K&R, but I'm 95% sure it's been supported from the beginning.  What 
hasn't always been supported is declaring variables anywhere other than after 
an opening bracket:

/* Local block */
{
        invoke_foo();
        int i;
        invoke_bar(&i);
        /* ... */
}

The argument for permitting declaration inside brackets (not as above, but as 
allowed by K&R) is to declare variables in as restrictive a scope as possible.  
The argument against is shadowing variables and getting subtle errors.

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