(j3.2006) Public Comment J32034

Van Snyder Van.Snyder
Wed Jul 16 14:34:00 EDT 2008

On Wed, 2008-07-16 at 11:55 -0600, Jim Giles wrote:
> As for allowing declarations inside every block (instead of only
> every BLOCK), take a look at the languages that have always 
> permitted that.  In C, programmers have always been allowed 
> to write declarations inside any "compound statement", not 
> just the one forming the body of a procedure.  I've only met
> one C programmer that did so extensively.  His colleagues 
> cursed him for it.  I've met long-time C programmers that 
> didn't even remember that such declarations were permitted:
> not only didn't they use the feature themselves, but they almost 
> never saw in code from other sources.
> Given the rarity of use of the feature, even when allowed, it's
> a good idea to call attention to nested declarations by making it 
> a separate construct.  So, BLOCK is better than letting the 
> declarations just go anywhere.

The problem in C (there's only one?) is that blocks are nearly
invisible: {}.

My friends who have written volumes of Ada code (e.g. the 1/3 million
lines in orbit around Saturn) find declarations within nested blocks to
be useful.

Declaration within nested blocks arises from the Algol tradition.
Fortran has been consistently moving in the direction of a higher-order
language.  C was designed to be a PDP/11 (or was it 3B?) assembler, and
it still is.  Should we really be seeking guidance there?

Van Snyder                    |  What fraction of Americans believe 
Van.Snyder at jpl.nasa.gov       |  Wrestling is real and NASA is fake?
Any alleged opinions are my own and have not been approved or
disapproved by JPL, CalTech, NASA, the President, or anybody else.

More information about the J3 mailing list