You're right!
https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/vsnprintf-vsnprintf-vsnprintf-l-vsnwprintf-vsnwprintf-l?view=vs-2017
vsnprintf
always writes the NULL terminator, and we can pass count=sizeof(buffer)
as C99 mandates.
_vsnprintf
does not, so we must set the buffer to zero, and pass count=sizeof(buffer)-1
.
The Microsoft specific API is much too complex!
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/OpenSmalltalk/opensmalltalk-vm","title":"OpenSmalltalk/opensmalltalk-vm","subtitle":"GitHub repository","main_image_url":"https://github.githubassets.com/images/email/message_cards/header.png","avatar_image_url":"https://github.githubassets.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm"}},"updates":{"snippets":[{"icon":"PERSON","message":"@nicolas-cellier-aka-nice on 4f6f191: You're right!\r\nhttps://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/vsnprintf-vsnprintf-vsnprintf-l-vsnwprintf-vsnwprintf-l?view=vs-2017\r\n`vsnprintf` always writes the NULL terminator, and we can pass `count=sizeof(buffer)` as C99 mandates.\r\n`_vsnprintf` does not, so we must set the buffer to zero, and pass `count=sizeof(buffer)-1`.\r\nThe Microsoft specific API is much too complex!"}],"action":{"name":"View Commit","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/4f6f191613f6bf6cdb989b39e1002cf4938f475c#commitcomment-31812755"}}}</script>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/4f6f191613f6bf6cdb989b39e1002cf4938f475c#commitcomment-31812755",
"url": "https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/4f6f191613f6bf6cdb989b39e1002cf4938f475c#commitcomment-31812755",
"name": "View Commit"
},
"description": "View this Commit on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>