TIL: many #pascal compilers allowed identifiers of any length, but only examined the first 8 characters to determine what the identifier pointed at.
So `foobarbaz` and `foobarbazqux` are both valid, but refer to the **same** variable!
What I _didn't_ learn was why anyone thought this was a good idea. I assume it was for performance reasons, since Free Pascal doesn't do it anymore (https://wiki.freepascal.org/Identifier#Significant_characters) and 8 makes me guess it has something to do with memory representation.
> Did you know that C compilers are still only required to support up to 4095 characters on a line of source code? If you have a line of code in your C program that's longer than that, the standard doesn't guarantee it has to be compiled correctly :)
I did _not_ know that! And it's per physical line, not per statement? So using a javascipt-style minifier for C source code and having a 1-line program would make the entire thing undefined?
@codesections Sort of :) If the compiler you're using says it's OK to do it in the manual, then it's OK to do it. gcc and clang and msvc could all handle it just fine. I'm not sure if tcc could, though.
> Sort of :) If the compiler you're using says it's OK to do it in the manual, then it's OK to do it.
Yeah, fair. I guess I should have said "implementation defined" instead of "undefined"
Merveilles is a community project aimed at the establishment of new ways of speaking, seeing and organizing information — A culture that seeks augmentation through the arts of engineering and design. A warm welcome to any like-minded people who feel these ideals resonate with them.