RE: [GD-General] Clean way of generalizing CDECL
Brought to you by:
vexxed72
From: Nick T. <ni...@ro...> - 2004-07-07 20:11:32
|
> -----Original Message----- > From: gam...@li... > [mailto:gam...@li...] On Behalf Of > Brian Hook > Sent: Tuesday, July 06, 2004 3:11 PM > To: gam...@li... > Subject: [GD-General] Clean way of generalizing CDECL >=20 > I'd like to be able specify CDECL in a cross-platform manner. On most > x86 compilers there's just the __cdecl keywod: >=20 > void __cdecl foo( int x, int y, int z ); >=20 > GCC, of course, does it completely differently: >=20 > void foo( int x, int y, int z ) __attribute((cdecl)); >=20 > So a simple #define won't work. Now, you can do a kind of convoluted > thing using a define, but damn, it's REAL ugly. Why not: #define foo(T,N, ...) T __cdecl N ( __VA_ARGS__ ) foo (int, blah, int a, int b) // declaration or #define foo2(T,N,A) T __cdecl N A=20 foo2 (int, blah, (int a, int b)) // declaration Nick |