Article View: comp.std.c++
Article #2273Re: Can I declare private constants?
From: David Vandevoorde
Date: Sat, 21 Oct 1995 22:39
Date: Sat, 21 Oct 1995 22:39
25 lines
1600 bytes
1600 bytes
>>>>> "ST" == Stefan Tilkov <st@mlc-ratingen.de> writes:
ST> fjh@munta.cs.mu.OZ.AU (Fergus Henderson) writes:
[...]
>> class X
>> {
>> private:
>> static const int fifty = 50;
>> };
[...]
>> int X::fifty;
ST> This one has always puzzled me. What is the rationale behind *still*
ST> requiring that X::fifty be defined somewhere if it is initialized in
ST> the class declaration?
[...]
The ODR, I would think. If one decides to use the address of this
constant, it'd better be unique. My compiler will not complain about
the absence of that definition as long as the address of the constant
is not required (i.e., the value can be substituted direcly).
Daveed
---
[ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu.
Contact address: std-c++-request@ncar.ucar.edu. The moderation policy
is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Technical Details
Message-ID:
<VANDEVOD.95Oct21142906@avs.cs.rpi.edu>Path:
arc1-ca.pugleaf.net!in2.uu.net!bounce-backReferences:
<9509118134.AA813443405@intugate.intuit.com> <9528514.26968@mulga.cs.mu.OZ.AU> <s6burc43zt.fsf@kirk.mlc-ratingen.de>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!in2.uu.net!bounce-back Date: 21 Oct 95 22:39:13 GMT Approved: fjh@cs.mu.oz.au From: vandevod@cs.rpi.edu (David Vandevoorde) Newsgroups: comp.std.c++ Subject: Re: Can I declare private constants? X-Original-Date: 21 Oct 1995 18:29:06 GMT Organization: RPI Computer Science Message-ID: <VANDEVOD.95Oct21142906@avs.cs.rpi.edu> References: <9509118134.AA813443405@intugate.intuit.com> <9528514.26968@mulga.cs.mu.OZ.AU> <s6burc43zt.fsf@kirk.mlc-ratingen.de> In-Reply-To: st@mlc-ratingen.de's message of 21 Oct 95 06:42:19 GMT X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBFAgUBMIl2p+EDnX0m9pzZAQFSaQGAjwIeu3co0k/uAwuPg++IJWi6CsIqO/h8 71ZtWRiJAGrUiou/6iNUbsdS0kvIZdZB =XkZD