Try:
#define REG(_Name, ...)\
{\
if(s_##_Name_Data.m_Enabled)\
Register(&s_##_Name_Data, __LINE__, __FILE__, __VA_ARGS__);\
}
Get rid of the token-pasting operator. You we're also missing a '\' in your macro (maybe a copy-n-paste error?).
Also, use va_arg()
, not va_args()
. And I'm not sure if you meant for _Name
to be _Name_Data
or the other way around.
Finally, I assumed that fp32
was an alias for float
; GCC had this to say to me:
C:\TEMP\test.c:22: warning: `fp32' is promoted to `double' when passed through `...'
C:\TEMP\test.c:22: warning: (so you should pass `double' not `fp32' to `va_arg')
C:\TEMP\test.c:22: note: if this code is reached, the program will abort
You should heed that warning. The program does crash for me if I do not.
Michael Burr
2010-08-07 00:02:27