Actually, using ill-created locale was the cause sprintf returned EILSEQ on %ls inserts containing emoji.
Signed-off-by: Simon Rozman <simon@rozman.si>
This allows same platform management across different operating systems.
Like with charset_id, the Windows numbering was adopted.
Signed-off-by: Simon Rozman <simon@rozman.si>
Microsoft declares all identifiers starting with underscore _ as
internal to MSVC. Thus, we should either use defined(DEBUG) or
!defined(NDEBUG) to distinguish Debug and Release builds.
Signed-off-by: Simon Rozman <simon@rozman.si>
While being here only for templates to work with various data types, the
one-byte "swap" functions are actually noop.
Signed-off-by: Simon Rozman <simon@rozman.si>
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>
Those are frequently used:
- UTF8: for exception message formatting
- ACP(OCP): for generic (console) output
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>
This avoids painful `.get()` in every `stdex::sprintf()` call. We could
use C++ polymorphism to add other sprintf variants, but the argument
combinations would explode.
Signed-off-by: Simon Rozman <simon@rozman.si>