std.math performance (SSE vs. real)

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Fri Jul 4 10:21:53 PDT 2014


On 7/4/2014 6:01 AM, Daniel Murphy wrote:
> long double may not be the same size as D's real, eg in msvc it's 64-bit. You
> can still still call these functions from D using double in C, but the mangling
> will not match in C++.


You are correct in that VC++ mangles double as 'N' and long double as 'O' but 
both are implemented as doubles.

This means that:

     void foo(long double d);

is callable from D if it is compiled as C, but not as C++.

This is not a language lawyer problem, as D isn't guaranteed to support all C++ 
mangling. As a practical problem, it would be pretty rare (since such code 
usually provides double overloads), and if it still was a problem a bit of 
adapter C++ code (a 1 liner) can be written.


More information about the Digitalmars-d mailing list