Bart Massey <[email protected]> writes:

> Well now I feel bad; I thought we had discussed this before and
> everyone was OK with it. I should revert that patch now, I guess? My
> sincere apologies for being premature.

Well, considering that it's already used in many places and that at
least X server specifies some mandatory C extensions[0] (from [1]),
including interleaved code and declarations, I don't see why this patch
should be reverted...

> For the record, though, I totally and vehemently disagree with the
> "bad style" argument. Separating definition from declaration is bad
> style, because it makes it easier to use a variable before it has been
> initialized. Whenever possible, variables should be declared at point
> of first assignment, so that it is clear that they have been
> initialized.(If you disagree, I challenge you to go back through old
> code and see how many uninitialized-variable bugs would have been
> easily caught by this convention--it will be lots.) Further, said
> definition should be as close as possible to the position of first
> use. This allows one to easily see the definition when trying to
> understand the code that uses the variable: a big aid to debugging and
> analysis.
>
> I know of no plausible SE case for declaring variables way up at the
> top of the block they are defined in other than tradition. It was
> originally done that way to make it easier for Fortran compilers,
> AFAIK. It's error-prone and makes code harder to read: it's a
> tradition we should enthusiastically abandon.

I agree.

-- 
Arnaud Fontaine

[0] http://cgit.freedesktop.org/xorg/xserver/tree/doc/c-extensions
[1] http://www.x.org/wiki/CodingStyle/
_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to