[U-Boot] use of C99

Timur Tabi timur at freescale.com
Wed Apr 8 23:01:51 CEST 2009


Scott Wood wrote:

> It frees the variable up for later such blocks to use.  As does 
> declaring iterators inside a for loop, but I guess that's forbidden as 
> well. :-)

I'm not sure whether we want to allow the same variable to be defined
more than once, even with the same type, inside a function.

> Chances are it will allocate all stack space for all variables up front, 
> regardless of where they're declared.

Yes, but it many cases it won't allocate any stack space at all because
it will just keep the variable in a register.  My point was that if a
variable is defined later in a function, then it's more likely to have
limited scope, so the compiler will be more likely to use a register
instead of stack to store it.

>> This is what we do today, and I think it's ugly.
> 
> Yes.  But not as ugly as having two #ifdef blocks.

Agreed, but I don't consider it to be much of a compromise.

-- 
Timur Tabi
Linux kernel developer at Freescale


More information about the U-Boot mailing list