Hacker News new | past | comments | ask | show | jobs | submit login

Notoriously? I can't name any architecture/platform/compiler where bits aren't allocated consecutively in order of definition, without holes, in the same direction as system endianness...



Try this in clang and gcc:

    #pragma pack(1)
    struct S {
        char c:1;
        char d:1 __attribute__((aligned(2)));
        char e:1;
    };
    _Static_assert(sizeof(struct S) == 1, "wrong size");


gcc?

MSVC does things simply, gcc does not




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: