Thread View: comp.std.c++
1 messages
1 total messages
Started by Peter GOLDE
Fri, 17 Aug 1990 19:14
Allow initializers on static data members
Author: Peter GOLDE
Date: Fri, 17 Aug 1990 19:14
Date: Fri, 17 Aug 1990 19:14
32 lines
1504 bytes
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
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