Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Jan 2005 20:10:49 +0000
From:      Peter Edwards <peadar.edwards@gmail.com>
To:        Paul Richards <paul@originative.co.uk>
Cc:        arch@freebsd.org
Subject:   Re: c99/c++ localised variable definition
Message-ID:  <34cb7c84050128121077633d22@mail.gmail.com>
In-Reply-To: <20050128173327.GI61409@myrddin.originative.co.uk>
References:  <20050128173327.GI61409@myrddin.originative.co.uk>

next in thread | previous in thread | raw e-mail | index | archive | help
> 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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?34cb7c84050128121077633d22>