From: "John Ratliff" <webmaster@technoplaza.net>
To: "'MSX to GCC'" <gcc-help@gcc.gnu.org>
Subject: RE: C++ static integer class constants...
Date: Tue, 18 Oct 2005 06:19:00 -0000 [thread overview]
Message-ID: <20051018061900.bCZd3IrfSGhXamqwMCOFQG1MVhx22Qtd0I6r-JmN3SI@z> (raw)
In-Reply-To: <873bn0rm24.fsf@mid.deneb.enyo.de>
> * John Ratliff:
>
> > On comp.lang.c++, Victor Bazarov says my example program is well-formed
> > standard C++ according to the ISO C++ standard.
> >
> > "Since their address is never taken, the 'foo::A' and 'foo::B' are, in
> > fact, compile-time constant expressions that do not require storage.
> > The objects, therefore, don't need to be defined outside of the class
> > definition.
>
> This analysis argues from the implementation, not from the standard.
>
> The standard requires that you provide a definition if you use the
> constant in a place which does not *require* a constant expression.
> In other words,
>
> int foo[Class::static_const_member];
>
> is fine without a definition, but
>
> int bar = Class::static_const_member;
>
> is not.
>
> It's strange and smells like a mistake in the standard.
In response to my message on comp.lang.c++, Greg Comeau replies
"That's what it says but isn't what it meant. What it meant is what Victor
said, and hence it was acknowledged as a defect since requiring the
definition in all cases was not the intent when member constants were
allowed."
So, it seems that it is a mistake in the standard. For anyone who doesn't
know him, Greg Comeau is a member of the C++ standards committee.
I think g++ is trying to do the correct thing (according to the intent of
the committee), even in 3.3, but has one problem area. I am going to leave
out my definitions for now since it will compile on both 3.3 and 3.4 now
that I've removed the ternary expression.
--John Ratliff
next prev parent reply other threads:[~2005-10-18 6:19 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <87oe5pb5dp.fsf@totally-fudged-out-message-id>
2005-10-17 19:17 ` Florian Weimer
2005-10-18 6:19 ` John Ratliff [this message]
2005-10-18 6:19 ` John Ratliff
[not found] <0IOJ0024ULK8BF@emroute1.cind.ornl.gov>
2005-10-18 12:26 ` Ernest L. Williams Jr.
[not found] <200510160743.j9G7hVoa010304@inbound-smtp-1.corp.adobe.com>
2005-10-17 12:05 ` John Love-Jensen
2005-10-17 17:50 ` John Ratliff
2005-10-17 17:50 ` John Ratliff
[not found] ` <4353e481.0829b6d6.64bd.18a4SMTPIN_ADDED@mx.gmail.com>
2005-10-17 18:07 ` corey taylor
2005-10-17 20:04 ` John Ratliff
2005-10-17 20:04 ` John Ratliff
[not found] <20051016195314.7EFB824AEF5@lax-gw02.mroute.net>
2005-10-17 9:09 ` Nathan Sidwell
2005-10-17 19:21 ` Florian Weimer
[not found] <20051016200125.C061F13137C@arvo.suso.org>
2005-10-16 21:36 ` John Ratliff
2005-10-16 21:36 ` John Ratliff
2005-10-16 15:26 Ryan Mansfield
2005-10-16 16:16 ` John Ratliff
2005-10-16 16:16 ` John Ratliff
2005-10-16 16:42 ` John Ratliff
2005-10-16 16:42 ` John Ratliff
[not found] ` <43528310.03f34613.6a05.0e40SMTPIN_ADDED@mx.gmail.com>
2005-10-16 17:43 ` Alex J. Dam
[not found] ` <4352a3b2.42389977.3b5e.60fdSMTPIN_ADDED@mx.gmail.com>
2005-10-16 19:29 ` Alex J. Dam
2005-10-16 19:53 ` John Ratliff
2005-10-16 19:53 ` John Ratliff
2005-10-16 19:45 ` John Ratliff
2005-10-16 19:45 ` John Ratliff
[not found] <435202e6.3d759d8f.4550.fffff1e6SMTPIN_ADDED@mx.gmail.com>
2005-10-16 14:50 ` Alex J. Dam
2005-10-17 19:13 ` Florian Weimer
-- strict thread matches above, loose matches on Subject: below --
2005-10-16 7:35 John Ratliff
2005-10-16 7:35 John Ratliff
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20051018061900.bCZd3IrfSGhXamqwMCOFQG1MVhx22Qtd0I6r-JmN3SI@z \
--to=webmaster@technoplaza.net \
--cc=gcc-help@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).