Commit 76bfbf38 authored by Reini Urban's avatar Reini Urban
Browse files

change sprintf_s retval to -1 on errors

See GH #45.
In this case I (and all others) think the standard made an error.
All existing implementations do return -1 on errors, all similar functions do return -1.
The revision and rationale for this change is: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1141.pdf
keeping count += sprintf(buf + count, format_string, args); valid, when no encoding errors can occur.
google site:www.open-std.org vsprintf_s.

Even Microsoft itself, who changed this behaviour in the standard with n1141, changed it later
back to return -1 consistently.
Document the deviation, and test it against msvcrt.
parent 90e9db1e
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment