dmg@ssc-vax.UUCP (David Geary) (06/20/89)
I've heard before that const is better supported in C++ than in C. Is this true? If so, why? Thanx, -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~ David Geary, Boeing Aerospace, Seattle ~ ~ "I wish I lived where it *only* rains 364 days a year" ~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
turner@sdti.SDTI.COM (Prescott K. Turner) (06/22/89)
In article <2742@ssc-vax.UUCP> dmg@ssc-vax.UUCP (David Geary) writes: > > I've heard before that const is better supported in C++ >than in C. Is this true? If so, why? It's because in C++ you can define a name to be const and it is then usable in contexts which require a constant. For example, const int size = 5; int a[size]; Also if you don't take the address of the const object, cfront can optimize its storage out of existence. In order for this to be easy to use, declaring something const implies that it has internal linkage. So it can be initialized in a header file making its value is available to every module which needs it. -- Prescott K. Turner, Jr. Software Development Technologies, Inc. P.O. Box 366, Sudbury, MA 01776 USA (508) 443-5779 UUCP: ...{harvard,mit-eddie}!sdti!turner Internet: turner@sdti.sdti.com