Subject: Re: [boost] std::map::find() wrapper
From: Marsh Ray (marsh_at_[hidden])
Date: 2011-05-05 14:35:00
On 05/05/2011 10:17 AM, Thorsten Ottosen wrote:
> Den 05-05-2011 16:53, Thorsten Ottosen skrev:
>> Den 05-05-2011 16:48, Marsh Ray skrev:
>>> sizeof(T*) is guaranteed to be nonzero, and in practice is 4 or 8 bytes,
>>> whereas references are allowed to have no size at all.
>> Can you mention just one ABI where references are merely pointers?
> ... not merely ...
So I'm interpreting that as "Can you give an example of an actual C++
program where the compiler does not emit the same code for references as
the analogous code using plain pointers."
... I played around with g++-4.6.0 and was not able to make it emit
different code in the short time I'm willing to try. G++ seems to miss
some opportunities for optimization of references, and seems to be smart
about tracking pointer values.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk