You are right. I verified this myself. I do not know where I got this wrong. Maybe this was different in earlier implementations.

It was first added to the Single UNIX Specification (SUS) in 1997. Perhaps there was some oddball non-conformant implementation at the time, but in those cases the standard would usually use a different name.

There's the infamous strncpy, of course, which understandably could cause some confusion. And various non-vendor faux-snprintf implementations, like uprintf, that have different semantics. It's hazardous to reuse a standardized name like snprintf, even as a suffix, in an API but not implement the same fundamental semantics.

I got this wrong from Microsoft Visual Studio (before 2015 and Windows 10) where the function snprintf did not add the null character. The function _snprintf still has the behavior that it does not add the null character.

See section 'Remark' on: https://learn.microsoft.com/en-us/cpp/c-runtime-library/refe...