long double in C APIs
Walter Bright via Digitalmars-d
digitalmars-d at puremagic.com
Mon Sep 15 16:19:51 PDT 2014
On 9/15/2014 3:24 PM, David Nadlinger wrote:
> 1. We need to teach everybody to not use 'real' when declaring C APIs, even
> though it's currently all over the place.
They should use c_long_double when interfacing with C and C++.
> 2. It effectively forces everybody to make all conversions to long double
> explicit in their code,
This is due to D currently not allowing implicit conversion to a struct. It's a
general issue, and should be dealt with as a general issue, as it comes up
whenever a wrapped type is used.
> at least if it they want to be cross-platform
> compatible. As the conversion will still be implicit on all platforms other than
> Win64 (and potentially some GDC/LDC targets), it seems like this could turn into
> another size_t-style portability trap.
I wouldn't call it a "trap", just a minor issue that the compiler will complain
about.
> I guess this has already been discussed more extensively, though. I even seem to
> remember talking about making real equivalent to the 64 bit long double type on
> MSVC targets (which IIRC GDC is going to do anyway). As I've been more or less
> out of the loop for a while, could somebody please point me to the relevant
> threads/issues/DIPs/…?
Even if we did that, it doesn't solve the issue of C++ name mangling for types
that D doesn't have, such as 'long' and 'unsigned long'. Those will still need
to be wrapped types.
More information about the Digitalmars-d
mailing list