[Python-Dev] test_builtin failing? or just 64-bit platforms (original) (raw)

Tim Peters tim.one@home.com
Sun, 2 Dec 2001 15:06:06 -0500


[Jeremy]

Definitely correct on the latter. Sensibly conservative on the former. The Linux man pages are silent on negative return values other than -1.

My draft copy of C99 sez:

The snprintf function returns the number of characters that would have
been written had n been sufficiently large, not counting the
terminating null character, or a negative value if an encoding error
occurred.

-1 isn't mentioned at all. What does the final C99 say? Regardless, MS's pre-C99 implementation says:

_snprintf returns the number of bytes stored in buffer, not counting
the terminating null character. If the number of bytes required to
store the data exceeds count, then count bytes of data are stored in
buffer and a negative value is returned.

So -1 sounds Linux-specific.

Thanks for the fixes.

Thank you for the opportunity to be thorough .