lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


 > This would turn the original block of code into this:
 > 
 > 	#ifdef WIDE_CHARACTERS_IN_USE
 > 	fwprintf(stderr, _T("OOPS!  Bad thing just happened!"));
 > 	#else
 > 	fprintf(stderr, _T("OOPS!  Bad thing just happened!"));
 > 	#endif

Please, please, never use #ifdef in code, only in header files.
It's much better to try, e.g,

#ifdef WIDE_CHARACTERS_IN_USE

typedef wchar_t lua_char;
#define lua_fprintf fwprintf
#define lua_atoi    wtoi

...

#else

typedef char lua_char;
#define lua_fprintf fprintf
#define lua_atoi    atoi

...

#endif


And then in the body of the code use

  lua_fprintf(stderr, _T("the cat ate my gymsuit"));


Norman