const comparison in C and C++

Doug Schmidt schmidt at beaver.ics.uci.edu
Thu Sep 15 16:59:00 AEST 1988


Hi,

   Would someone please explain to me the rationale behind C++'s
allowance of ``const's'' objects for use with specifying array size
declarations, as opposed to ANSI-C's reject of this construct?  For
example, the following is legal C++:

----------------------------------------

const int Bar = 100;
int Foo[Bar]; // declares an array of 100 ints

----------------------------------------

However, this does not work with the ANSI-Cesque compilers I've 
tried (gcc, for example).  I'm interested to know the conceptual
differences between the two languages on this point.

thank you,

   Doug Schmidt



More information about the Comp.lang.c mailing list