> On May 12, 2016, at 1:12 AM, 军其 胡 <junq...@me.com> wrote:
> 
> The Xcode (or Apple Clang) gives the results with both 3.000000.  I have 
> tried to compile the same code by GCC on Fedora 22 and obtain the opposite 
> results with both -3.000000. It's ridiculous since abs and std::abs are lying 
> in different namespaces.

I believe fabs is one of those magic standard-library functions that the 
compiler is allowed to replace with inline assembly, since that’s more 
efficient than a function call. In that case it would just ignore your 
definition. (This is probably defined somewhere in the C spec, but I’m not 
about to dive in and look for it.)

(For example, I know this happens with memcpy — when invoked with a small 
constant size, both GCC and Clang will frequently generate a series of 
load/store instructions rather than call the actual memcpy function.)

These seem like very artificial examples; is there something realistic you’re 
trying to do that’s giving you trouble with Clang?

—Jens
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (Xcode-users@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/xcode-users/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to