[U-Boot] use of C99

Graeme Russ graeme.russ at gmail.com
Thu Apr 9 00:39:38 CEST 2009


On Thu, Apr 9, 2009 at 7:38 AM, Timur Tabi <timur at freescale.com> wrote:
> Wolfgang Denk wrote:
>
>> Bear with an old man like me. I am used to the habit that variables
>> get decleared at the begin of a block, not in the middle of it. When
>> searching for the declaration of a variable, I find it a major PITA if
>> I have to scan the whole source file instea dof just looking at the
>> first few lines of a block.

I'll second that

>
> This is why I use an advanced programmer's editor that brings me to the
> definition of the variable under the cursor with a single keystroke.
>

What if _MY_ favourite editor doesn't. Or what if I don't have access to
it because I'm looking at the code at work, or on a friends computer?

>> Not the compiler, but humans like me. I have just a small  window  of
>> lines  I  can  really  focus  on,  and  the  smaller  a block of code
>> (including the needed variable declarations), the easier  I  get  the
>> impression I understand it.

That is the key - half the time #ifdef COOL_FEATURE in the middle of a
function really means that the feature needs to be put in another
function

>
> In this case, it would be easier for you if the variable were declared
> next to the code that uses it.

True and correct, but it can often be done so in another function

>
>>> This is what we do today, and I think it's ugly.
>>
>> It is ugly, but much less ugly than variable declarations right in the
>> middle of 200 lines of code.

200 lines of code is much more ugly


Regards,

Graeme


More information about the U-Boot mailing list