On 6 February 2012 19:24, Anthony Liguori <anth...@codemonkey.ws> wrote: > On 02/02/2012 08:59 PM, Andreas Färber wrote:
>> +#define CPU(obj) OBJECT_CHECK(CPU, (obj), TYPE_CPU) >> +#define CPU_CLASS(class) OBJECT_CLASS_CHECK(CPUClass, (class), TYPE_CPU) >> +#define CPU_GET_CLASS(obj) OBJECT_GET_CLASS(CPUClass, (obj), TYPE_CPU) >> + >> +typedef struct CPU CPU; > > If this doesn't result in a build error, then C is a worse language than I > thought it was :-/ > > But we definitely shouldn't have a typename and macro name of the same thing > and expect it to work... The C standard says that function-like macros are only applied when the function-like macro name is followed by a '(' as the next preprocessing token, so this isn't relying on any kind of gcc-specific behaviour. Whether we *want* to do it is largely a style issue :-) -- PMM