Chapman Flack <chap@anastigmatix.net> writes:
> I'm in sympathy with all of those points. I've never believed that the
> arbitrary separation of declaration from use that was forced by C < 99
> made anything more readable. If the project were started now from scratch,
> I would be all in favor of declaring at first use.
Yeah, if we were starting today, I'm sure we'd use C99 or C++ as our
baseline and not arbitrarily exclude some language features. But ...
we're not. The rule against declaration-after-statement was kept
after significant discussion, which you can find in the archives if you
look. We're not going to drop it just because one person shows up with
a patch to do so.
>>> It uses a Perl regex to search and replace! (obligatory jokes at the
>>> bottom of the email)
> However, even if such an idea were to get the green light, I think I would
> take the obligatory regex jokes seriously, and instead use something like
> srcML [0] and do the analysis and modification on proper parse trees.
Agreed. I think the odds of introducing bugs are near 100% if it's done
without using a tool that actually understands the code semantics.
regards, tom lane