[dmd-internals] Testcase in test42.d
Walter Bright
walter at digitalmars.com
Fri Apr 5 17:02:49 PDT 2013
On 4/5/2013 3:56 PM, David Nadlinger wrote:
>
> My point here is that C compiler might not align the same data to 16 bytes.
Consider the following C code:
--------------------------------------
#include <stdio.h>
struct S {
int a[4];
};
int x;
struct S s;
struct T {
int t;
struct S s;
};
void main()
{
printf("%p %p %d\n", &x, &s, sizeof(struct T));
}
------------------------------
I compiled it with gcc under Linux. x is aligned to 4 bytes, and s is aligned to
16 bytes (you can see this using dumpobj on the object file). The sizeof(struct
T) is also 20 bytes, just like in dmd.
dmd is behaving just like gcc does.
More information about the dmd-internals
mailing list