From 9134811156668999748
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,7458762a2c3b301d
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 2001-08-22 16:57:02 PST
Path: archiver1.google.com!news2.google.com!newsfeed.google.com!newsfeed.stanford.edu!newsfeeds.belnet.be!news.belnet.be!colt.net!dispose.news.demon.net!news.demon.co.uk!demon!mail2news.demon.co.uk!not-for-mail
From: clarkcox3@yahoo.com (Clark S. Cox III)
Newsgroups: comp.std.c++
Subject: Re: Are literals const?
Date: Wed, 22 Aug 2001 23:46:25 GMT
Organization: BELLSOUTH.net
Approved: Fergus Henderson <fjh@cs.mu.oz.au>, moderator of comp.std.c++
Message-ID: <1eyk3q6.1irf87j1d0hh9aN%clarkcox3@yahoo.com>
References: <7dc3b1ea.0108220617.421ee131@posting.google.com>
X-Trace: mail2news.demon.co.uk 998523990 mail2news:12336 mail2news mail2news.demon.co.uk
X-Complaints-To: abuse@demon.net
X-Mail2News-Path: news.demon.net!mulga.cs.mu.oz.au
X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
User-Agent: MacSOUP/2.4.6
X-Abuse-Info: Please be sure to forward a copy of ALL headers
X-Abuse-Info: Otherwise we will be unable to process your complaint properly.
NNTP-Posting-Date: Wed, 22 Aug 2001 19:37:13 EDT
Lines: 29
Xref: archiver1.google.com comp.std.c++:7086

Peter Dimov <pdimov@mmltd.net> wrote:

> What do you think about this piece of code:
> 
> int main()
> {
>   int const & r = 5;
>   const_cast<int &>(r) = 6;
> }
> 
> Is this legal? I think that it is. Literals aren't const (they are
> about 90% const, but not 100% const.)

    Literals aren't objects. In the code above, a temporary object is
created with the value 5, a reference is then made to that temporary
object, and 6 is assigned to that temporary object.


-- 
Clark S. Cox III
clarkcox3@yahoo.com
http://www.whereismyhead.com/clark/

---
[ 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://www.research.att.com/~austern/csc/faq.html                ]



