3 ms·
Pascal strings had the same size overhead as C strings. One using the "byte" for length, the other for size.
by knorker 3y ago
Pascal strings had the same size overhead as C strings. One using the "byte" for length, the other for size.
- elteto 3y agoBut C strings could at least be arbitrarily long, Pascal strings were extremely handicapped. It’s like they understood why length prefix is better, but then picked the worst possible implementation.
- compiler-guy 3y agoPascal strings were a bad implementation of general strings, but were extraordinarily easy to implement.
- chinabot 3y agoscreens were generally 80 characters wide 256 was good enough, if you needed to go bigger null terminated could still be done in pascal, you just had to roll your own. The editors I wrote back in the eighties were just linked lists of pascal strings so a line was limited to 256 characters but these were very fast in VMS and DOS Also we only had a few character sets and you could live your whole life in ASCII
- compiler-guy 3y agoAnd worse for pascal, a 256 byte limit on the length and api shenanigans so that not every string allocated needed to consume all that memory if the string itself was shorter.