c99/c++ localised variable definition

Peter Edwards peadar.edwards at gmail.com
Fri Jan 28 12:10:50 PST 2005


> Personally, I find the c++/perl convention to be much less error prone
> and more intuitive and since c99 now supports it too it seems the
> standards body sees the benefits of this approach as well.

I also, personally, like using this particular feature when writing
userland code.  However, in terms of kernel stuff, there's a practical
reason for grouping definitions of local variables together: you can
have a much better idea of how much stack space you are using when
introducing a new definition when all other definitions are nearby.
i.e., although a pleasing feature in terms of writing clean code in
algorithmically, it can be quite a danger when dealing with a very
limited stack.


More information about the freebsd-arch mailing list