🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #354

Allow initializers on static data members

#354
From: Peter GOLDE
Date: Fri, 17 Aug 1990 19:14
32 lines
1504 bytes
One modification to the standard that I think would be useful would
be amend 9.4 to allow static data members to have initializers.  Such
data members would then have _internal_ linkage.  If multiple files define
the same data members, the initializers must be the same.

The advantages of this are:

1.  It is exactly parallel with declaring member functions inside a class
    definition; they also have internal linkage.

2.  Having the static member have internal linkage would prevent the 
    problems noted in 9.4 of the ARM.  A single thing would not
    have multiple definitions.

3.  It would allow the construction below:

    class TABLE_OF_STUFF
    {
    ....
    private:
        static const int tablesize = 147;
        static const thetable[tablesize];
    };

    This cannot be accomplished by placing the initializer outside
    the class declaration as is now required.  With the current language
    definition, an enum is required to do this -- surely a perversion
    of the enum concept.

--Peter Golde
  uunet!microsoft!petergo
  petergo%microsoft@uunet.uu.net
Technical Details
Message-ID: <56680@microsoft.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!microsoft!petergo

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!microsoft!petergo
From: petergo@microsoft.UUCP (Peter GOLDE)
Newsgroups: comp.std.c++
Subject: Allow initializers on static data members
Message-ID: <56680@microsoft.UUCP>
Date: 17 Aug 90 19:14:57 GMT
Reply-To: petergo@microsoft.UUCP (Peter GOLDE)
Organization: Microsoft Corp., Redmond WA
Lines: 32