D
Default User
Boltar said:Hi
Why - using gcc on linux - does this return 0 in C but returns 1 in C+
+? I don't get it.
#include <stdio.h>
struct foo
{
};
main()
{
printf("%d\n",sizeof(struct foo));
}
Seems like it's not a legal declaration in C. From the C99 draft
standard:
A structure type describes a sequentially allocated
nonempty set of member objects (and, in certain
circumstances, an incomplete array), each of which has
an optionally specified name and possibly distinct
type.
VC++ correctly flags this as an error. I tried a few options with gcc
3.3.1 but didn't get it to trigger a diagnostic. I suggest discussing
it over in comp.lang.c if you have further interest.
Brian