this post was submitted on 25 Jan 2024
22 points (78.9% liked)
C Programming Language
993 readers
1 users here now
Welcome to the C community!
C is quirky, flawed, and an enormous success.
... When I read commentary about suggestions for where C should go, I often think back and give thanks that it wasn't developed under the advice of a worldwide crowd.
... The only way to learn a new programming language is by writing programs in it.
- irc: #c
π https://en.cppreference.com/w/c
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
This is not a correct comparison as rust strings support UTF8. Try doing that with char*!
uint32_t* goes brrr
That's not utf8 either...
max width of utf8 is 32 bits from my extensive research (1 minute of googling) so it should work, right?
UTF-8 is a variable encoding so none of the fixed sized type would work better for it.
But it would work
It would no longer be UTF-8; it would be UTF-32. UTF-8 is an encoding scheme, meaning that it is a specification for exactly how text is encoded as bits.
You can certainly use UTF-32 to represent all valid unicode, but you can only do that within the bounds of a single program; once you need to read or write data to or from an external source (say, the file system, or over a network), you'd need to use the same encoding that the other software uses, which is usually UTF-8 (and almost never UTF-32).