🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Can I declare private constants?

#2281
From: Alex Martelli
Date: Sun, 22 Oct 1995 23:32
30 lines
2018 bytes
st@mlc-ratingen.de writes:
	...
>> Note that you still need a definition of X::fifty somewhere:
>> 
>> 	int X::fifty;

>This one has always puzzled me. What is the rationale behind *still* 
>requiring that X::fifty be defined somewhere if it is initialized in
>the class declaration?

Suppose the program, in various different source files, takes the address
&X::fifty, and saves it in int* variables; then, at some later points,
those variables are compared for equality of their contents.  We want
to ensure that such equality holds.  That the _contents_ of X::fifty
are defined in the header seen by each such source file has obviously
no relevance to this -- the _location_ of it must also be defined,
and, clearly, it will have to be in exactly one place to guarantee
the equality holds...


Alex
--
DISCLAIMER: these are TOTALLY personal opinions and viewpoints, NOT connected
in any way with my employer, nor any other organization or individual!
Email: martelli@cadlab.it                            Phone: +39 (51) 597313
CAD.LAB s.p.a., v. Ronzani 7/29, Casalecchio, Italia   Fax: +39 (51) 597120
---
[ 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: <martelli.814356512@cadlab>
Path: arc1-ca.pugleaf.net!in2.uu.net!bounce-back
References: <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: 22 Oct 95 23:32:46 GMT
Approved: fjh@cs.mu.oz.au
Newsgroups: comp.std.c++
From: martelli@cadlab.cadlab.it (Alex Martelli)
Subject: Re: Can I declare private constants?
Message-ID: <martelli.814356512@cadlab>
X-Newsreader: NN version 6.5.0 #11
Organization: Cad.Lab Spa, Bologna, Italia
References: <9509118134.AA813443405@intugate.intuit.com>  <9528514.26968@mulga.cs.mu.OZ.AU> <s6burc43zt.fsf@kirk.mlc-ratingen.de>
X-Original-Date: Sun, 22 Oct 1995 10:08:32 GMT
X-Auth: PGPMoose V1.1 PGP comp.std.c++
 iQBFAgUBMIrUuOEDnX0m9pzZAQEy5wF+PVhM1eqDnlFSyN47spk3+xVeY5dCVe9K
 XHcs/3DzU99eixI3Y62Ebo/warX9lF6U
 =rqcT