3 ms·
Nothing prevents those operating systems from offering custom string types.
by imtringued 3y ago
Nothing prevents those operating systems from offering custom string types.
- rwmj 3y agoIn reality, a ton of stuff does. As an example: What do you do if someone calls your new string+length API with an embedded \0 character? Your internal functions are all still written in C and using char* so they will silently truncate the string. So you need to check and reject that. Except you forgot there are also APIs (like the extended attrs APIs) that do accept embedded \0. The exceptions are all over the place, in ioctl calls passed to weird device drivers etc.
- GoblinSlayer 3y agoWindows internally uses string+length struct, null terminated string API is just compatibility interface on top of it.
- pantalaimon 3y ago*new operating systems You can't change the string type without breaking all apps and services.
- yjftsjthsd-h 3y agoEven on a new OS it's going to be a compatibility problem. Implementing even partial POSIX compatibility makes porting stuff easier, but changing how stings work is going to make it significantly harder.