| ▲ | WalterBright a day ago | |
Back in the 80s, when I was writing a C compiler, C compilers typically had a maximum size for string literals. The behavior was to detect overflow, issue an error message, and fail compilation. I took a different tack. The buffer was allocated with malloc. When a string was larger, it was realloced to a larger size. This worked until memory was exhausted, and then the program quit. It was actually less code to implement than having a fixed size buffer. Ditto for the other compilation limits, such as length of a line. The only limit was running out of memory. | ||