strtoi() is complementary to strtoui() returning size_t. But, intptr_t
is complementary to uintptr_t, and ptrdiff_t is complementary to size_t.
I know it doesn't matter on flat-memory platforms, but nevertheless, we
try to keep things organized in a portable way.
Signed-off-by: Simon Rozman <simon@rozman.si>
The standard C++ approach is preferred over legacy C-style string
operations. Some helpers have clean standard C++ implementation on
std::string(_view) classes. All were just a simple .data() and .size()
wrappers for legacy C functions.
The main concern is the amount of helpers that require maintenance.
Signed-off-by: Simon Rozman <simon@rozman.si>
Unfortunately, MSVC cannot deduce template parameters properly where
`const std::basic_string_view<...>` is the parameter. It requires
explicit type cast or explicit template type specification. Which kind
of voids the whole purpose of using std::basic_string_view to make the
client code simpler.
Example: https://gist.github.com/rozmansi/493911be70bdac08dc6826c976c5bbe4
Signed-off-by: Simon Rozman <simon@rozman.si>
No need to use locale-specific character type detection when ASCII.
Locale-specific implementation on Windows is not that very fast.
Signed-off-by: Simon Rozman <simon@rozman.si>
"C"-locale is basically ASCII while (Microsoft) implementation is not
quite performant to our likes. We can do faster.
Signed-off-by: Simon Rozman <simon@rozman.si>
It requires libuuid-devel on Linux and since this function is optional, lets
not impose libuuid-devel dependency on anything that #include
<stdex/string.hpp>.
Signed-off-by: Simon Rozman <simon@rozman.si>
While runtime asserts also served as MSVC Code Analysis hints, the lack
of asserts in Release builds provides no hints to Code Analysis which
rises a lot of warnings then.
Maybe I should learn how to use SAL to annotate <ptr, len> parameter
pairs to allow ptr==nullptr when and only when len==0? 😇
Signed-off-by: Simon Rozman <simon@rozman.si>
Not that we would like to promote the use of C locale_t over C++
std::locale, but we need former for sprintf and we need decent support
for it.
Signed-off-by: Simon Rozman <simon@rozman.si>