4 ms·
Pascal-strings were not uncommon in C at one point, rather than null-terminated strings. They lost, but in a sense, they didn't, since all the string-manipulati
by thrower123 7y ago
Pascal-strings were not uncommon in C at one point, rather than null-terminated strings. They lost, but in a sense, they didn't, since all the string-manipulation functions we use nowadays take a length parameter anyways.
- zoomablemind 7y agoThe notion was that strings would be consumed fully, thus the starting pointer could be used for iteration, and null char is a natural end condition. Here it is, saving an int and cycles for tracking length. It's just coding in such way appears to be too low-level. Pointer in programmer's hand became akin to neuro-surgeon's scalpel... casually performing surgery often on 'self' and with shaky hands. Sure, take this length to limit potential damage.