svn commit: r185356 - head/sys/dev/ixgbe
M. Warner Losh
imp at bsdimp.com
Thu Nov 27 09:57:32 PST 2008
In message: <9bbcef730811270238k61c3e59fqee7715f017d70ccf at mail.gmail.com>
"Ivan Voras" <ivoras at gmail.com> writes:
: 2008/11/27 Dag-Erling Smørgrav <des at des.no>:
: > "Ivan Voras" <ivoras at gmail.com> writes:
: >> And at least the newer GEOM code also uses c99 variable declarations
: >> (not only for initializers - they were c99 from the start).
: >
: > I'm curious about what you mean with "c99 variable declarations". If
: > you are referring to loop variable declarations, I can only find two
: > cases, both in g_linux_lvm.c. Other than that and mixing declarations
: > with statements (which style(9) explicitly forbids), there is no
: > difference between c89 to c99 as far as variable declarations are
: > concerned.
:
: Yes, but not only loops - I mean things like:
:
: if () {
: struct *something abc;
: int y;
: ...
: }
:
: You'll probably find my code is one the biggest users of this style
: but I've only started using it when I saw it already used.
This is a K&R level C construct.
It is discouraged in style(9) because it makes it hard to find
declarations. However, it is used in the kernel in a number of
places.
I personally really dislike the style (and yes, I know all the
arguments for it). If you really want something that complex inside a
block to need block scoped variables, then that really argues for a
function oft times...
Warner
More information about the svn-src-all
mailing list