News for hackers. Stuff that matters.
Re:An update on GNU performance by ploxiln on Sunday October 21, 2018 @06:01PM (#18270594)
"char" has something else unusual going on. If you compare it to a "unsigned char" in an if-condition, and compile with -Wall -Wextra, you'll get a warning about casting. If you compare it to a "signed char" on the same system, you'll still get the warning! In fact "char" is not considered to be exactly the same as "signed char" or "unsigned char", it has 3 variants! Even though logically it must be one or the other on a particular platform. So you could think of char as mostly characters, whether ascii, or iso8859-1, or utf8 code-units ...

Functions like toupper() take an int but say "the value must be representable as an unsigned char" so you technically need to cast to "unsigned char" on most platforms, but I doubt anybody uses these functions for anything but ascii. They may work for single-byte locales like iso8859-1 etc if you have the locale env vars set right, but they won't work for non-ascii chars encoded as utf-8, which is generally what you always want to use these days. (There's towupper() which works with 2-byte locales like UCS-2, which is utf-16 without surrogate pairs, and can't represent all the new unicode chars, but you probably don't want to go there, you want some modern unicode library that works properly with utf-8 or UCS-4.)

Re:An update on GNU performance by caf on Sunday October 21, 2018 @07:25PM (#18270971)
towupper() works with wide chars, which aren't necessarily 2-bytes. In fact on UNIX-like systems wchar_t tends to be 32 bits and wide chars are usually UCS-4.
Re:An update on GNU performance by ploxiln on Sunday October 21, 2018 @07:46PM (#18271051)
I honestly didn't know that ... I've never actually used the libc wchar_t functions :)
Re:An update on GNU performance by romed on Sunday October 21, 2018 @10:57PM (#18271852)
Good, because nobody should use wchar_t at all. It's the API that was thought up by people who got drunk and asked themselves "how can we make this char situation even worse?" wchar_t is widely recognized as one of those huge mistakes from the 90s, along with UCS-2. Today you should store strings in as bytes using UTF-8 and if you need to handle them in a fixed-width format you would choose an explicit 32-bit-wide type.
Re:An update on GNU performance by colejohnson66 on Monday October 22, 2018 @11:37AM (#18275517)
Except when you’re on Windows and have to use WCHAR to handle Unicode characters because they use UCS-2, not UTF-8
Re:An update on GNU performance by romed on Monday October 22, 2018 @12:26PM (#18276013)
On Windows WCHAR is defined to hold a 16-bit unicode character, and is defined to be unsigned. In standard C wchar_t can be any damn thing, and isn't even guaranteed to be wider than char. It can be signed or unsigned. It is useless.