Early versions of BBC BASIC, including ARM BASIC VI which is the latest and 'best' from the Acorn stable, have a maximum string length of 255 bytes!! Can you believe it?
Why would anyone not believe it. It's a natural thing to do:
When implementing strings what can one do? Have a pointer to memory and a length stored with the string. Like Pascal. Or have a pointer to memory and put a null byte at the end. Like C. Have two pointers, one to the start of the string and one to the end. Something else?
Given the tiny amounts of memory the machines C was developed on, and the desire for strings of any length it makes sense to do what C did, don't store the length and put a null on the end.
Given the tiny amounts of memory the machines BASIC and Pascal were developed on, it makes sense to restrict the size of the length field, wherever you store it, to a single byte.
I suspect the Pascal/BASIC guys were more concerned with numerical calculation than text processing so it makes sense that they use a length field for strings. Only one byte, to save memory. It has algorithmic advantages.
The C guys needed to be able to write compilers and such text processing tools, so it makes sense they allowed for long strings.
The 255 byte limit is very constraining, but I think I can see how it has survived. The original size matched the available memory in the first RISC OS machines.
I don't follow. I'm pretty sure even the first RISC OS machines had a lot more than 256 bytes of RAM!
Memory in C++ is a leaky abstraction .