4 ms·
> “I know, I’ll use a library to do strlen()!” — nobody, ever. The standard library provided by languages like C, C++ is a library. Features like character str
by wyldfire 3y ago
> “I know, I’ll use a library to do strlen()!” — nobody, ever.
The standard library provided by languages like C, C++ is a library. Features like character strings are present and it's a totally reasonable expectation for the length to give you the cluster count.
- AnimalMuppet 3y agoNo, for C and C++, which are close to the hardware, it's totally reasonable to expect strlen() to give you the byte count. You don't allocate memory for buffers based on the cluster count. If you want cluster count, call a different function.
- macintux 3y agoGiven that strlen() predates Unicode by...30 years(?) - it's not terribly surprising that isn't a viable approach.