Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I suspect null terminated strings predate C, C is just just one of many languages that can use them.


The PDP-10 and PDP-11 assemblers had direct support for nul-terminated strings (ASCIZ directives, and OUTSTR in MACRO10) which Ritchie adopted as-is, not unlike Lisp’s CAR/CDR. It’s not entirely clear that other “high-level” languages at the time also used such a type.

Although later ISA added support for it for C compatibility, whereas older ISAs tended to only support fixed-length or length-prefixed, for instance the Z80 has LDIR, which is essentially a memcpy, copying a terminated string required a manual loop.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: