Tech Off Post

Single Post Permalink

View Thread: New C++ runtime library
  • User profile image
    Sven Groot

    , sysrpl wrote

    I am working on a library for C++ which is small, has no dependencies other than itself (i'm not using boost), works on all platforms, and most importantly is as friendly as C#.

    Out of curiosity, how do you deal with unicode? This is always the thing that trips me up when trying to write cross-platform C++ code. On Windows, you must use wchar_t; using char is simply not an option. On Linux, wchar_t is very wasteful (4 bytes), unnecessary because char supports utf-8, and syscalls don't accept wchar_t string arguments. However, a lot of the std library string manipulation stuff doesn't actually work with multi-byte strings of char.

    The only way I've found to handle this is to take dependencies on things like ICU, which are rather big (~10MB).

    EDIT: On a sidenote, how does WriteLine work? It's either not typesafe (very, very bad) or your library only supports compilers with support for variadic templates (not very many at the moment).