digitalmars.D.learn - sizeof
- Ellery Newcomer (37/37) Jan 01 2011 Hello. Been trying to link to some C code with gdc on 64 bit, and I've
- Manfred_Nowak (3/4) Jan 01 2011 prints 16 ( DMD 2.051 on win32)
- Ellery Newcomer (2/6) Jan 01 2011
- Manfred_Nowak (10/11) Jan 02 2011 So we have:
Hello. Been trying to link to some C code with gdc on 64 bit, and I've
been racking my brain over the following:
//tok.d
import std.stdio;
struct x {
union _u_{
ulong uq;
struct _s_ {
ushort dw;
uint dd;
};
_s_ s;
};
_u_ u;
ushort zz;
}
void main(){
writeln(x.sizeof);
}
//tok.c
#include <stdint.h>
#include <stdio.h>
struct x {
union {
uint64_t uq;
struct {
uint16_t dw;
uint32_t dd;
} s;
} u;
uint16_t zz;
};
void main(){
printf("%d\n", sizeof(struct x));
}
the d code prints 12, and the C code prints 16. Should I be expecting
the two to be the same?
Jan 01 2011
Ellery Newcomer wrote:d code prints 12prints 16 ( DMD 2.051 on win32) -manfred
Jan 01 2011
curious. prints 12, DMD 2.051 linux On 01/01/2011 06:15 PM, Manfred_Nowak wrote:Ellery Newcomer wrote:d code prints 12prints 16 ( DMD 2.051 on win32) -manfred
Jan 01 2011
Ellery Newcomer wrote:prints 12, DMD 2.051 linuxSo we have: ( linux32 , dmd 2.051) -> 12 ( linux32 , gdc) -> 12 ( linux64 , gdc) -> 12 ( linux64 , ldc) -> 16 ( win32 , dmd 2.051) -> 16 ( cygwin32, gdc) -> 16 Congrats Ellery: this looks like a stairway to hell. -manfred
Jan 02 2011








"Manfred_Nowak" <svv1999 hotmail.com>