logoalt Hacker News

phba • yesterday at 8:31 PM • 1 reply • view on HN

Not sure if you are being sarcastic. Pascal strings are first class citizens, so it's trivial to add null-termination. Delphi actually does this to allow typecasting.

C, for example, doesn't have strings. It has pointers to memory that might contain characters and, if you are lucky and the stars are aligned, a zero to mark the end. I'll never understand how C strings were accepted as a string representation and not the mad source of bugs and insanity that they are.


Replies

tzot • yesterday at 9:05 PM

> I'll never understand how C strings were accepted as a string representation

1972 was definitely not a good year for C standardization bodies. I blame that guy Ritchie and his audacity to hack a language on a whim. Even his GitHub page is empty (or misattributed).