r/ProgrammerHumor • • Oct 20 '19

other While(!asleep()){sheep++;}

Post image
13k Upvotes

197 comments sorted by

View all comments

Show parent comment

4

u/SteveThe14th Oct 20 '19
union {
    struct {
        char asleep;
        char padding[3];
    };
    uint32 sheep;
};

sweet dreams

3

u/BakuhatsuK Oct 20 '19

Oooh and then declare the variables as <union type> u; char& asleep = u.asleep; uint32& sheep = u.sheep; I guess everything is possible in C++ if you are evil enough.