Dale Johannesen wrote:
On May 3, 2005, at 11:03 AM, Nathan Sidwell wrote:
Seeing through the const-stripping cast is a useful optimization.
It is? Why would somebody write that?
perhaps a function, which returned a non-const reference that
happened to be bound to a constant, has been inlined.
IMO, no, but surely we don't have to worry about this one. Either way
is standard conformant and the user's intent is far from clear, so whatever
we do should be OK.
If we guarantee one to work and not the other, we need to have a clear
specification of how they differ. What if intermediate variables -- either
explicit in the program, or implicitly during the optimization -- get
introduced?
My guess is that the wording of the standard might be the best that
could be achieved in this regard. It would be nice to have some clear
wording indicating that Mike's example will work, but some other, possibly
closely related, example will not.
nathan
--
Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
[EMAIL PROTECTED] :: http://www.planetfall.pwp.blueyonder.co.uk