|
Boost : |
From: Steven Watanabe (steven_at_[hidden])
Date: 2007-10-10 23:22:27
AMDG
Simonson, Lucanus J <lucanus.j.simonson <at> intel.com> writes:
> If the function call is inline the compiler knows whether the pointer is
> the same or not and if it does not know it does not reorder the
> instructions because it *might* be the same.
What I'm saying is that compiler "knows" that the two pointers
are not the same because if they are the same you have undefined
behavior anyway so it's not non-conformant if it does something
strange.
> In the back-end the
> compiler doesn't have any idea what object type the pointer was anymore
> and certainly doesn't use that information to outsmart itself. The
> compiler is pessimistic and conservative in nature in the optimizations
> it makes. If compiler providers chose to do what you suggest they might
> then they would catch no end of grief until they rolled back the change.
I remember seeing something related a while back. Ah,
here it is. http://lists.boost.org/Archives/boost/2006/10/111792.php
In Christ,
Steven Watanabe
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk