tiemann@arkesden.ebay.sun.com (Michael Tiemann) (10/22/89)
Date: Tue, 17 Oct 89 12:21:14 -0600 From: grunwald@foobar.colorado.edu (Dirk Grunwald) To: bug-g++@prep.ai.mit.edu Subject: static const vs. const Reply-To: grunwald@foobar.colorado.edu Office: 6-1 EECR (303) 492-0452 I'm not certain if this is a bug or feature; before, when I have the file: ----------foo.cc---------- const int notStatic = -1; static const int isStatic = -1; -------------------------- compiling & using nm would show that notStatic has space allocated; this is useful if refer to it in other files as ``extern const int notStatic''. the current version of g++ doesn't allocate a variable for either from. if this is the intended action, than I would think that referring to ``extern const int notStatic'' should generate an error. Dirk Grunwald -- Univ. of Colorado at Boulder (grunwald@foobar.colorado.edu) I have change GNU C++ so that `const' by itself will not cause space to be allocated. If you want space allocated, the specifying `static' will get you space if you take the address of the const thing, and specifying `extern' will allocate space and make the const thing public, so that others can use it (for value or address). Michael