You cannot have an empty structure in C. It is a syntactic constraint violation.
However gcc permits an empty structure in C as an extension.
Furthermore the behaviour is undefined if the structure does not have any named member because
C99
says :
If the struct-declaration-list contains no named members, the behavior is undefined.
So
struct Empty {}; //constraint violation
struct Empty {int :0 ;}; //no named member, the behaviour is undefined.
And yes size of an empty struct is C++ cannot be zero :)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…