Thanks for the quick reply. As per the C++ standard (ISO/IEC 14882, 1998 first edition)
Section 9: Classes definition says. Complete objects and member subobjects of class type shall have nonzero size. Corrent me if i'm wrong here, but from this i had concluded empty object and structures are not part of C++ standard (or maybe my copy of standard is old). And they're implemented as part of GCC/G++ extension. If so, then my question stands that how do we decide that a structure is empty ? As per the definition of empty structures extension, should have size 1 byte in g++. So what do we call structures which return size 0 in g++ ? Eg: struct T4 {long int:0;}t4; //has size 1 in g++ whereas struct T1 {struct{}a[0]; }t1; //has size 0 in g++ As based on the size of object, optimization can take place at the caller and callee side (eg: ignoring of records with 0 size in the argument list of variable arguments to reduce stack operation). And since G++/GCC has ABI compatibility with several other compilers, i was hoping if there would be some rule to distinguish as to when to assign 1 byte and when 0 for empty structures. Warm Regards, Naveen ------- Original Message ------- Sender : Jonathan Wakely<jwakely....@gmail.com> Date : Jan 03, 2013 00:17 (GMT+09:00) Title : Re: Query for Empty Structure Extension. On 2 January 2013 14:32, NAVEEN CHANDRAKAR wrote: > > My question is what is the definition/grammer of empty structure. As i > couldn't find it covered in C/Cxx standard document. The page you linked to defines a GCC extension to the C language, so if course it's not in the C standard. As the page says, ISO C++ allows empty structures, it's just a class with no members, which is valid in ISO C++ anyway.