
7 Sep
2011
7 Sep
'11
8:44 a.m.
On 09/07/2011 03:08 AM, Beman Dawes wrote:
If native_to_big, as an example, was supplied only as:
T native_to_big(T x);
then the code for big-endian systems wouldn't just be a no-op. A copy, no matter how fast, is a slower than a no-op. Of course a really smart compiler might optimize the do-nothing copy away.
Assuming T is a POD, if the function is inlined, the copy will be elided. I wouldn't think it really requires a particularly smart compiler.