From -7870931501082549261
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,f5d433881cc29cff
X-Google-Attributes: gidf78e5,public
From: bparker@gil.com.au (Brian Parker)
Subject: Re: Named return value optimisation- reprise.
Date: 1997/06/20
Message-ID: <33a9d7e0.2094012@news.ipswich.gil.com.au>#1/1
X-Deja-AN: 251293636
References: <33a345bf.7425526@news.ipswich.gil.com.au> <33A478C1.329@acm.org> <33a4e2d5.24720499@news.ipswich.gil.com.au> <33A54D26.F46@acm.org> <5o3v6c$cv3@mulga.cs.mu.OZ.AU> <33A5A723.E9F@acm.org> <5o5mgd$mkv@mulga.cs.mu.OZ.AU> <33A6A1F9.D0E@acm.org> <5o7nd2$4ms@mulga.cs.mu.OZ.AU>
X-Original-Date: Fri, 20 Jun 1997 02:04:33 GMT
Organization: Global Info-Links News Server
X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBFAgUBM6pCAOEDnX0m9pzZAQFV9AF+J3kobyU71GFUggiu3NkZM1KxJ+qCLO2Q UGOIVLgqimVPrtOEuns1pP9TjD2EeSGM =w6Pe
Newsgroups: comp.std.c++
Originator: fjh@mundook.cs.mu.OZ.AU


On 18 Jun 97 06:15:53 GMT, fjh@mundook.cs.mu.OZ.AU (Fergus Henderson)
wrote:

>Nope, your two example classes _are_ different from the outside:
>
>	const C2 c2;
>	const_cast<C2&>(c2).set_data(42);	// fine
>
>	const C1 c1;
>	const_cast<C1&>(c1).set_data(42);	// undefined behaviour

That's a good point. The fact that a compiler cannot make constness
"deep" (although logically it should) is exactly analogous to the
problem of determining what memory an object consists of.

,Brian Parker (bparker@gil.com.au)
---
[ 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         ]
[ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
[ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]



