i have the following struct, and i expect it to have 30 bytes
but sizeof tells me it has 32 bytes. dmd seems to still use 4byte alignment altough i specified to align 2bytes.

struct netadr_t {
        align(2):
    int    type; // 0
    int    scope_id; // 4
    short  port; // 8 // <-- this is 4 bytes instead of 2
    int    sock;   // 10

    union {
    ubyte[4]    ip; // 14
    ubyte[10] ipx;
    ubyte[16] ip6;
    }
}

since i'm interfacing with a c library the struct layout has to be equal :(

Reply via email to