|
|
|
|
|
by burnt-resistor
16 days ago
|
|
No, it's not bizarre, it's standardized on what is and isn't UB based on history, and usually for performance. NUL-terminated strings don't know their lengths and so, without an "n" variant function and running strlen() ahead-of-time, must iterate the entire thing. Pascal format strings (supported up to 255 byte lengths in the classic form) could find length as an O(1) operation because there was no terminator necessarily. |
|