C ABI: "__attribute__((allow_zero_size))" update?

Eddie Kohler kohler@icir.org
Thu Nov 21 10:22:00 GMT 2002


A thread from September ("C ABI: struct/union inconsistency",
http://gcc.gnu.org/ml/gcc/2002-09/msg01109.html) noted that the C and C++
compilers report different numbers for:

	struct empty { };
	printf("%d\n", sizeof(struct empty));

The proposed solution was to make "sizeof(struct empty)" 1 in both
languages, but provide an attribute like "__attribute__((allow_zero_size))"
or "tiny" or whatever that would make it 0 in both languages.

Did anyone decide on what the attribute should be called and implement the
attribute? This ABI incompatibility is currently causing me serious
problems, as I distribute a Linux kernel module written in C++.

Eddie Kohler
http://www.lcdf.org/kohler/



More information about the Gcc mailing list