D int and C/C++ int etc not really compatible when interfacing to C/C++
Shriramana Sharma via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Nov 1 08:00:49 PDT 2014
In the following pages:
http://dlang.org/interfaceToC.html
http://dlang.org/cpp_interface
the "Data Type Compatibility" section says D int is compatible with
C/C++ int. Isn't this actually false because D's integer types are
fixed-size whereas C/C++'s are variable? So D int is only compatible
with C++ int32_t, and who knows what that is typedef-ed to? Likewise
for uint, long, short etc.
So how to ensure, when calling C/C++, that the D int etc are being
mapped to the correctly-sized C/C++ type? Does the compiler ensure
that since the compatibility is being advertised as built-in?
--
Shriramana Sharma ஶ்ரீரமணஶர்மா श्रीरमणशर्मा
More information about the Digitalmars-d-learn
mailing list