Variable-length arrays

Peter S. Shenkin uunet!avogadro.barnard.columbia.edu!shenkin
Wed Dec 18 21:36:46 PST 1991


> I know I'm jumping into this discussion rather late but what's so bad
> about
> 
> 	int foo(double a[n], int n) { ... }   ?
> 
> I know that it's a bit of trouble for the compiler - it has to parse the
> entire function header before it can grok the first parameter - but that's
> certainly no worse than what C++ compilers have to do when they parse inline
> functions that are defined inside a class declaration.
> 
> And the above syntax is certainly more natural for a programmer, which ought
> to count for something.
> 
> Bob Wilber

I agree.  Certainly the whole point is to make life easier for the 
programmer, isn't it?  By the way, would Fortran require n to be declared
first? -- not that that has to be the model.  But if the only objection
to the above is that it's harder to write a parser for it, it doesn't seem to
me that that argument is worth much.  The parser only has to be written
once;  programs have to be written many times.

	-P.
************************f*u*cn*rd*ths*u*cn*gt*a*gd*jb*************************
Peter S. Shenkin, Department of Chemistry, Barnard College, New York, NY 10027
(212)854-1418    shenkinaavogadro.barnard.columbia.edu   shenkinacunixc.BITNET
********** "I've got algorithm -- who could ask for anything more?" **********




More information about the Numeric-interest mailing list