long double in C APIs

David Nadlinger via Digitalmars-d digitalmars-d at puremagic.com
Mon Sep 15 15:24:48 PDT 2014


There are currently a few pull requests related to interfacing to 
C's long double type on Win64, most of which have been already 
merged:
  - https://github.com/D-Programming-Language/dmd/pull/3981
  - https://github.com/D-Programming-Language/druntime/pull/958
  - https://github.com/D-Programming-Language/dmd/pull/3990

At first glance, this solution does not seem to be very appealing 
to me:

  1. We need to teach everybody to not use 'real' when declaring C 
APIs, even though it's currently all over the place.

  2. It effectively forces everybody to make all conversions to 
long double explicit in their code, 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 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/…?

Cheers,
David


More information about the Digitalmars-d mailing list