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