c99/c++ localised variable definition

Dag-Erling Smørgrav des at des.no
Sat Jan 29 05:11:29 PST 2005

Paul Richards <paul at originative.co.uk> writes:
> People used to programming in C++ or Perl (and many others) are used
> to defining variables as near to use as possible. This have never been
> possible before in C, but now with c99 it is.

It's a very bad idea, because you can introduce new variables whenever
you feel like, but you can't destroy them.  Defining variables at the
top of the scope forces you to think about which variables you need
and how long they will live.  Defining them on an ad hoc basis leads
to sloppy programming and stack abuse.

Dag-Erling Smørgrav - des at des.no

More information about the freebsd-arch mailing list