From -961600460266961795
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,7458762a2c3b301d,start
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 2001-08-22 13:18:01 PST
Path: archiver1.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: pdimov@mmltd.net (Peter Dimov)
Newsgroups: comp.std.c++
Subject: Are literals const?
Date: Wed, 22 Aug 2001 20:17:28 GMT
Organization: http://groups.google.com/
Approved: Fergus Henderson <fjh@cs.mu.oz.au>, moderator of comp.std.c++
Message-ID: <7dc3b1ea.0108220617.421ee131@posting.google.com>
X-Trace: mail2news.demon.co.uk 998511452 mail2news:10475 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)
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
NNTP-Posting-Date: 22 Aug 2001 14:17:09 GMT
Lines: 37
Xref: archiver1.google.com comp.std.c++:7081

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.)

Similarly:

int f()
{
  return 5;
}

int main()
{
  int const & r = f();
  const_cast<int &>(r) = 6;
}

Do we _really_ need non-const literals and rvalues (of built-in
types)?

--
Peter Dimov
Multi Media Ltd.

---
[ 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                ]



