🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Michael Tiemann Sat, 21 Oct 1989 20:54
`const' and space allocation
#523
Author: Michael Tiemann
Date: Sat, 21 Oct 1989 20:54
34 lines
1715 bytes
    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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads