c99/c++ localised variable definition
Ryan Sommers
ryans at gamersimpact.com
Mon Jan 31 06:36:37 PST 2005
Paul Richards wrote:
> I'd suggest that we allow the use of c99 variable definitions in a
> limited area of userland on a trial basis in order to gain some
> experience of whether we do or do not gain anything from their
> usage. The conservatives might feel that FreeBSD is not the place
> for such research but I disagree, I think that's exactly the sort
> of thing FreeBSD should be doing.
IMO this is a bad idea, unless you are volunteering to clean all the
dissenting code up if we decide to nix it in the future. A trial basis
or not we end up with the emerging and the old standard intermixed in
the code base. Granted there might be occasions when something new is
worth the effort. However, as I believe it was PHK that said, if the
current solution solves 90% of the problems regardless of if a new
solution solves 100% people won't want to change (was stated in regards
to a new version control system in hackers@).
One of the strengths of FreeBSD is such a rigorous coding style
requirement. It's one of the reasons I switched to FreeBSD from Linux a
long time ago.
> This wasn't really discussed, I think at the very least we should
> enable c99 as the base system compiler so that 1) we can be sure our
> code works with c99 and 2) it's available as the default compiler for
> third party use.
Available on the compiler sure, default, not until we are 100% certain
it doesn't introduce any oddities. What do we really gain from making
C99 the default if we don't allow any of the new features of the C99 syntax?
Personally I don't like even the ability to declare variables mid-block.
As others pointed out, I believe this lends itself more easily to sloppy
programming. Sure, you can be sloppy no matter what. But it's easier to
just throw a variable in if you don't have to take the extra time to
move up to the top and declare it. That little bit of extra time can be
all it takes to force yourself to think "do I really need this?" Or you
might look at your other declarations and realize, "hey I could use this
instead."
--
Ryan Sommers
ryans at gamersimpact.com
More information about the freebsd-arch
mailing list