www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Interface to C page has been screwed up a little

reply Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
http://d-programming-language.org/interfaceToC.html

Originally the table just showed D and C types, the 32/64 bit columns
weren't there. On my last commit I had this:

D type | C type

c_long (in core.stdc.config) | long
c_ulong (in core.stdc.config) | unsigned long
long | long long
ulong | unsigned long long

But now this table seems to have been mixed up and 32/64 bit columns
added, and c_long magically disappeared:

D type | C 32bit | C 64 bit
long | long long | long
c_ulong (in core.stdc.config) | ulong
ulong | unsigned long long | unsigned long

As far as I know, the correct table should be without those 32/64 bit
columns and instead be this:

D type | C type:

c_long (in core.stdc.config) | long
c_ulong (in core.stdc.config) | unsigned long
long | long long
ulong | unsigned long long

C's long and unsigned long might be different on Windows and Linux 32
and 64 bit versions, hence c_long and c_ulong from core.stdc.config.

Is my interpretation correct, so I can make a pull to fix this?
Aug 05 2011
parent Jacob Carlborg <doob me.com> writes:
On 2011-08-05 20:36, Andrej Mitrovic wrote:
 http://d-programming-language.org/interfaceToC.html

 Originally the table just showed D and C types, the 32/64 bit columns
 weren't there. On my last commit I had this:

 D type | C type

 c_long (in core.stdc.config) | long
 c_ulong (in core.stdc.config) | unsigned long
 long | long long
 ulong | unsigned long long

 But now this table seems to have been mixed up and 32/64 bit columns
 added, and c_long magically disappeared:

 D type | C 32bit | C 64 bit
 long | long long | long
 c_ulong (in core.stdc.config) | ulong
 ulong | unsigned long long | unsigned long

 As far as I know, the correct table should be without those 32/64 bit
 columns and instead be this:

 D type | C type:

 c_long (in core.stdc.config) | long
 c_ulong (in core.stdc.config) | unsigned long
 long | long long
 ulong | unsigned long long

 C's long and unsigned long might be different on Windows and Linux 32
 and 64 bit versions, hence c_long and c_ulong from core.stdc.config.

 Is my interpretation correct, so I can make a pull to fix this?

Yes. -- /Jacob Carlborg
Aug 05 2011