mercredi 22 janvier 2020

what is the special regarding int :0 in C++

struct S {
    char a;         // location #1
    int b:5,        // location #2
    int c:11,
    int :0,         // note: :0 is "special"
    int d:8;        // location #3
    struct {int ee:8;} e;   // location #4
};

It seems that int :0 member variable of a struct does not occupy any memory space, and it is marked as: // note: :0 is "special"

Does anybody know what is the special usage of int :0 here? Thanks

PS: sample code is quoted from http://www.stroustrup.com/C++11FAQ.html#memory-model

Aucun commentaire:

Enregistrer un commentaire