boostorg / core

Boost Core Utilities
133 stars 83 forks source link

Add portable snprintf/vsnprintf definition #132

Closed Lastique closed 1 year ago

Lastique commented 1 year ago

This definitions is mostly a workaround for older MSVC versions that only provided non-portable _snprintf etc. that are not fully conforming to the standard snprintf. This implementation fixes its issues wrt. null termination and returned values in case of buffer overflows.

On platforms that support the standard snprintf, the definitions in the header are equivalent to the standard functions.

pdimov commented 1 year ago

Are you waiting for me to merge this? It would be useful f.ex. for https://github.com/boostorg/lexical_cast/pull/56.

Lastique commented 1 year ago

I was going to merge it after the 1.81 release to avoid potential inconvenience in case if we need to merge develop to master for a pre-release bug fix. But I guess I can do it early.