If building code like this:
unsigned long val = 1000; snprintf(buf, sizeof(buf), "%+lu", val);
with clang, clang warns
warning: flag '+' results in undefined behavior with 'u' conversion specifier [-Wformat]
Therefore, don't construct such undefined format strings.
This fixes number formatting in mingw-w64 if built with
__USE_MINGW_ANSI_STDIO defined (there, the '+' flag causes a
leading plus to be printed when formatting unsigned numbers too,
while the '+' flag doesn't cause any extra leading plus in other
stdio implementations).
Please parenthesize (__flags & ios_base::showpos) for clarity. (Otherwise I could imagine a compiler thinking you'd typoed & for &&.)