DAN Fe (danfe) wrote in unixhistory,
DAN Fe
danfe
unixhistory

About null pointers

Interesting quote from here:

The first two bytes of every VAX Unix program were zero (a register save mask saying not to save anything). As a result, a null all-zero pointer was always valid, and if a C program used a null value as a string pointer, the zero byte at location zero was treated as a null string. As a result, a generation of Unix programs in the 1980s contained hard-to-find bugs involving null pointers, and for many years, Unix ports to other architectures provided a zero byte at location zero because it was easier than finding and fixing all the null pointer bugs.
  • Post a new comment

    Error

    default userpic
  • 0 comments