Article View: comp.std.c++
Article #2183Re: Proposal for a new access specifier
From: Hallvard B Furuseth
Date: Fri, 13 Oct 1995 16:52
Date: Fri, 13 Oct 1995 16:52
29 lines
1874 bytes
1874 bytes
In article <MTM4.1250.01029391@rsvl.unisys.com> MTM4@rsvl.unisys.com (Mike McCormick) writes:
>>This is an example where it would be usefull to be able to initialize
>>not only static but also nonstatic datamembers inside the class defn.
>>
>> class Thing {
>> private:
>> int readOnly;
>> public:
>> const int* const pReadOnly =&readOnly; // ILLEGAL
>> };
>
> Just supposing this *were* legal syntax, how is it an improvement over the
> constructor initializer syntax?
If it were legal, pReadOnly need not take any space in the class becuase
the compiler would always know where it pointed. Just like `const int
&const pReadOnly = &readOnly;' might do if legal.
With constructor initializer syntax, the compiler can only know where
pReadOnly points if the constructor is inlined.
--
Regards,
Hallvard
[ 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:
<HBF.95Oct13174324@durin.uio.no>Path:
arc1-ca.pugleaf.net!engnews2.Eng.Sun.COM!taumet!clamageReferences:
<199509221547.JAA10782@ncar.ucar.EDU> <MATT.95Sep24112332@Austern> <44spqj$j37@nn.fast.net> <MTM4.1214.010BD7A3@rsvl.unisys.com> <45e5v6$3ac@sunsystem5.informatik.tu-muenchen.de> <MTM4.1250.01029391@rsvl.unisys.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!engnews2.Eng.Sun.COM!taumet!clamage From: h.b.furuseth@usit.uio.no (Hallvard B Furuseth) Newsgroups: comp.std.c++ Subject: Re: Proposal for a new access specifier Date: 13 Oct 1995 16:52:11 GMT Organization: University of Oslo, Norway Approved: clamage@eng.sun.com (comp.std.c++) Message-ID: <HBF.95Oct13174324@durin.uio.no> References: <199509221547.JAA10782@ncar.ucar.EDU> <MATT.95Sep24112332@Austern> <44spqj$j37@nn.fast.net> <MTM4.1214.010BD7A3@rsvl.unisys.com> <45e5v6$3ac@sunsystem5.informatik.tu-muenchen.de> <MTM4.1250.01029391@rsvl.unisys.com> NNTP-Posting-Host: taumet.eng.sun.com Content-Type: text X-Nntp-Posting-Host: durin.uio.no In-Reply-To: MTM4@rsvl.unisys.com's message of 12 Oct 1995 14:55:02 GMT Content-Length: 828 X-Lines: 25 Originator: clamage@taumet