C vs. FORTRAN (was: What should be added to C)
Barry Shein
bzs at bu-cs.UUCP
Thu May 29 15:09:22 AEST 1986
>FORTRAN lets
>you use a variable as a bound in an array declaration, in this special case.
>That probably wouldn't be too hard to add to C; in fact it might be possible
>to generalize it to allow *any* nonstatic array declaration to have variable
>size (within reason).
If I remember right DMR said that at some point in time automatic arrays
with variable sizes was in C but they took it out, not sure why though.
I think he said in the early C compilers it was a matter of removing a
comment or thereabouts to re-enable (memory fades...)
About the only major complication I see (and this may have been the original
problem) is error handling. Not sure exactly what would happen if it were
impossible to allocate the automatic (then again, that can come up now,
I guess it's just a SIGSEGV or some such, but kinda weird to recover from,
hmm, interesting.) Portability? no, I really can't think of any reason,
it can't vary during the activation of the routine so you just adjust the
stack via a variable rather than a constant (an extra add instruction per
var array, big deal...) No, oh well, seems easy to me, whadidimiss?
-Barry Shein, Boston University
More information about the Comp.lang.c
mailing list