On 30 Dec 2009, at 19:24, Greg Ercolano wrote:

>       Solution on win32 is to change _snprintf() to _snprintf_s()
>       with the _TRUNCATE macro as the third argument. But there's no
>       clear way to use a macro shortcut to do this (since this is a
>       varargs function), so a cross platform solution is tricky at best.

Well, if we can assume C99 compliance (I'm not sure that we can) and  
that the C++ compiler also supports variadic macros (most do, but it  
is not part of any C++ spec yet, AFAIK...)

Then, something like:

#ifdef WIN32

#  define SNPRINTF(SS, CC, ...) snprintf(SS, CC, _TRUNCATE, __VA_ARGS__)

#else

#  define SNPRINTF(SS, CC, ...) snprintf(SS, CC, __VA_ARGS__)

#endif


Maybe?
Not actually tried this, just typed it verbatim, but I think it  
should work... I've used variadic macros widely before and it has  
been OK.



_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to