[llvm-commits] [llvm] r91842 - /llvm/trunk/include/llvm/Support/Format.h

Michael Beck mm.beck at gmx.net
Tue Dec 22 03:51:14 PST 2009


>> This broke the MSVC build, please take a look.
> I don't have vcpp around, but this patch unbreaks a mingw build (which
> was broken for quite long time). I explained, why it is incorrect
> regardless of compiler.
>
> I'd really appreciate if someone with vcpp access look into this issue.
> Maybe we should do a #ifdef _MSC_VER, but this is still a hackish way to
> do things :(
>
> Note, that the most notable difference of snprintf and _snprintf is that
> the latter *does not* guarantee NULL termination!

This is a "typical" problem on MSVC builds. The regulary solutions for this 
are

a) the #define snprintf _snprintf way
b) define an own snprintf() which handles the NULL termination. MSVC even 
supports a /Fi option
that is called forced include. This way, a header file containing the 
snprintf can be included by the commandline ...

b) Seems to be the right solution here with an #ifdef MSVC around the 
definition.

best regards,
-- 
Michael Beck 




More information about the llvm-commits mailing list