ENH: MSVS 2013 snprintf compatible substitute

Simplify the backwards compatible snprintf configuration for pre
1900 version of MSVC.  Otherwise prefer C++11 syntax using std::snprintf.
This commit is contained in:
Hans Johnson
2018-12-12 13:31:55 -06:00
committed by Christopher Dunn
parent ccd077ffce
commit 5c8e539af4
5 changed files with 37 additions and 27 deletions

View File

@@ -54,6 +54,14 @@
#define JSON_API
#endif
#if defined(_MSC_VER) && _MSC_VER < 1900
// As recommended at https://stackoverflow.com/questions/2915672/snprintf-and-visual-studio-2010
extern JSON_API int msvc_pre1900_c99_snprintf(char *outBuf, size_t size, const char *format, ...);
# define jsoncpp_snprintf msvc_pre1900_c99_snprintf
#else
# define jsoncpp_snprintf std::snprintf
#endif
// If JSON_NO_INT64 is defined, then Json only support C++ "int" type for
// integer
// Storages, and 64 bits integer support is disabled.