[IGSTK-Users] snprintf versus _snprintf

Steve Robbins smr at sumost.ca
Wed Sep 20 16:21:31 EDT 2006


Hi,

I'm building IGSTK using cygwin on WindowsXP.

It doesn't compile out-of-the-box, due to this bit of code in  
Source/igstkNDICommandInterpreter.cxx:

// On MSVC and Borland, snprintf is not defined but _snprintf is.
// This should probably be checked by CMake instead of here.
#if defined(WIN32) || defined(_WIN32)
#ifndef snprintf
#define snprintf _snprintf
#endif
#endif


It's not a good assumption that WIN32 systems have _snprintf() but not  
snprintf().  Cygwin has the latter but not the former.

As the comment says, this should be checked by CMake.  Moreover, it  
ought to actually check for the presence of snprintf() rather than  
relying on a complicated "#if" conditional using compiler and OS  
symbols...

Sorry, but I've only got time for this rant and not a patch ;-)

-Steve




More information about the IGSTK-Users mailing list