public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Eljay Love-Jensen <eljay@adobe.com>
To: svisor@lycos.com, gcc-help@gcc.gnu.org
Subject: Re: Inherited member( void )const - const to be or not to be
Date: Tue, 07 Sep 2004 17:10:00 -0000	[thread overview]
Message-ID: <6.1.2.0.2.20040907115841.02c9e0b0@iplan-mn.corp.adobe.com> (raw)
In-Reply-To: <chknvj$ca2$1@sea.gmane.org>

Hi Jarmo,

 >name__more is not reserved.

Yes it is.  ISO 14882 section 17.4.3.1.2.

 >Usage of _Name is not recomended, but what I know not reserved.

Yes it is.  ISO 14882 section 17.4.3.1.2.

 >Do you have any link to a list of which combinations are reserved and 
which are not?

Only by citing the section in the ISO 14882 standard.  Note:  I'm referring 
to the 1998 one.  I don't have the revised standard.

 >NO! You _broke_ it! Now you return a pointer to constant, and thats _NOT_ 
what I wanted.

g++ -DCONST= foo.cpp

Then neither the pointer returned, nor the up-cast function are committing 
to const protection.

 >The question was more about cast from "this", like this:

Do this then:

virtual CProvider* getProvider() const { return const_cast<CProvider*>(this); }

Note:  on my team, this code would not be acceptable in a code 
review.  Very dangerous.  If you REALLY have to have a non-const futzing, 
consider putting the functionality IN the class itself, so the class can 
manipulate its own internal state in a "non-const" fashion via a const 
method, yet retain logically const state.  Otherwise, it's an egregious 
violation of the const contract.

 >I do not agree as thats not portable across all compilers.

It is portable across all C++ compilers that I use, and I use quite a few 
different ones on a wide variety of platforms.  It may not be portable 
across some very old compilers.

It's also portable across all C++ compliant compilers.  But that's not 
saying much, because I don't think there are any fully ISO 14882 compliant 
compilers available.  (Hmmm, maybe EDG is fully compliant, I'm not sure.)  :-)

Sincerely,
--Eljay

  reply	other threads:[~2004-09-07 17:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-06 11:01 SVisor
2004-09-07 12:58 ` Eljay Love-Jensen
2004-09-07 16:35   ` SVisor
2004-09-07 17:10     ` Eljay Love-Jensen [this message]
2004-09-21 13:34 ` Claudio Bley
2004-09-21 13:41   ` Claudio Bley
2004-09-07 16:40 lrtaylor

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=6.1.2.0.2.20040907115841.02c9e0b0@iplan-mn.corp.adobe.com \
    --to=eljay@adobe.com \
    --cc=gcc-help@gcc.gnu.org \
    --cc=svisor@lycos.com \
    /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).