Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!arkesden.ebay.sun.com!tiemann From: tiemann@arkesden.ebay.sun.com (Michael Tiemann) Newsgroups: gnu.g++.bug Subject: `const' and space allocation Message-ID: <8910212054.AA09169@arkesden.sun.com> Date: 21 Oct 89 20:54:12 GMT Sender: daemon@tut.cis.ohio-state.edu Reply-To: tiemann@sun.com Distribution: gnu Organization: GNUs Not Usenet Lines: 34 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