2 ms·
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
by wahern 1y ago
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.
- fjfaase 1y agoI 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/reference/snprintf-snprintf-snprintf-l-snwprintf-snwprintf-l?view=msvc-170 https://learn.microsoft.com/en-us/cpp/c-runtime-library/refe...