Hello There, Empty Structures :- http://gcc.gnu.org/onlinedocs/gcc/Empty-Structures.html I came across this extension and understood why empty-structures were introduced as an extension in gcc and g++. But i couldn't find any relevant text as to what is considered as empty structure.
Eg: T2 and T4 below have size 0 and 1 in gcc and g++ respectively as they're
considered to be empty structure.
struct T2
{}t2;
struct T4
{long int:0;}t4;
---WHEREAS---
T1, T5 and T6 below have size 0 in both gcc and g++.
struct T1
{struct{}a[0]; }t1;
struct T5
{struct{
struct{
struct{long d[5];
void * e;
short f[7];
}c;
int g;
int h:25;
}b[0];
}a; }t5;
struct T6
{
short:0;
struct
{
struct{int d;
}c[1];
struct __attribute__((aligned (1), packed)){}e[0];
float f;
}b[0];
}t6;
My question is what is the definition/grammer of empty structure. As i couldn't
find it covered in C/Cxx standard document.
Also will the structures above T1, T5 and T6 be called empty structures ?
Please find attached, the file comprising of examples above with gcc version
4.6.1 (Ubuntu/Linaro 4.6.1-9ubuntu3)
Warm Regards,
Naveen
test.c
Description: Binary data
