Topic: const class-member variable


Author: Jim Hyslop <jim.hyslop@leitch.com>
Date: 1999/04/18
Raw View
In article <37161197.78824643@nntp.ix.netcom.com>,
  miker3@ix.netcom.com (Michael Rubenstein) wrote:
> 9.4.2 does not disallow initializers for non-const members.  It
> says that they are allowed for const (int|enum) members and adds
> to the semantics for const members, but it makes no statement
> that they are disallowed for other members.
Right, I follow you now.

--
Jim
I ignore all email from recruitment agencies.
Please do not send me email with questions - post here.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own
---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]





Author: miker3@ix.netcom.com (Michael Rubenstein)
Date: 1999/04/13
Raw View
On Mon, 12 Apr 1999 15:03:54 GMT, Jim Hyslop
<jim.hyslop@leitch.com> wrote:

>In article <3711449a.9058285@nntp.ix.netcom.com>,
>  miker3@ix.netcom.com (Michael Rubenstein) wrote:
>[snip]
>> 9.4.2 says that if it is also const then it may be used as an
>> integral constant expression.  9.2 allows it for any static
>> integral or enumeration types, but if it is not const it may not
>> be used as an integral constant expression.
>
>I don't agree with your interpretation.  9.2 states "A member-declarator can
>contain a constant-initializer only if it declares a static member (9.4) of
>integral or enumeration type, see 9.4.2"  - I read this to mean "see 9.4.2
>for a clarification of the details."  Why would 9.4.2 specifically disallow
>initializers for non-const members, if 9.2 allowed it for both?
>
>Either 9.4.2 should drop the "const", or 9.2 should add the const - it's
>inconsistent.
>
>Followups for this discussion have been set to comp.std.c++ (I hope :-)

9.4.2 does not disallow initializers for non-const members.  It
says that they are allowed for const (int|enum) members and adds
to the semantics for const members, but it makes no statement
that they are disallowed for other members.
--
Michael M Rubenstein
---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]