[RFC] CodingStyle Question
Devin Bayer
devin at freeshell.org
Thu Feb 23 19:49:28 UTC 2006
Mike Frysinger wrote:
> On Thursday 23 February 2006 13:49, Devin Bayer wrote:
>>Bernhard Fischer wrote:
>>>On Thu, Feb 23, 2006 at 09:53:19AM -0800, Devin Bayer wrote:
>>>
>>>>Declarations following code within a function
>>>
>>>Is this benefical compared to just using a different scope?
>>
>>Do you mean inserting useless braces just to declare more variables? Of
>>course, because there are no useless braces. It's very useful with
>>flexible-length arrays since you may need to perform some calculations or
>>test some arguments before knowing the size of the array.
>>
>>>Depending on the context, the latter may produce even smaller code..
>>
>>It's only a visual difference.
>
> no it isnt ... Bernhard is correct here
>
> this is basically hints to gcc so it doesnt try and save/restore variables all
> the time even when we know it isnt needed
GCC knows where in the function you start using the variable and where you stop.
The fact that the compiler can reliably emit an error when you use a variable
outside of scope is evidence of this fact. Blocks without flow constructs are
only for the help of the programmer, but they are ugly and almost never used.
--
Devin Bayer
More information about the busybox
mailing list