Doug Ewell posted:

The use of NULL to terminate strings is a basic part of the Standard C
library, not just certain APIs. As such, it doesn't seem right to call
this a "misuse" of the character.
But ISO 646, in defining ASCII, states as the defintion of the control character NULL:

"A control character used to accomplish media-fill or time-fill. Null characters may be inserted into or removed from a stream of data without affecting the information content of that stream. But then the addition or removal of these characters may affect the information layout and/or the control of equipment."

Its basic use was for block filling and on text terminals for filling screen memory before use. The definition also allowed for unpunched areas on punched tape to be ignored.

The use of NULL in C and Unix as a string terminator is certainly a misuse of the NULL character as orginally defined.

It amuses me to think of this, and also the use in C of LF only for what in ISO 646 would require the use of CR + LF, when Unix people sometimes rant about Microsoft and Macintosh computers not properly following standards.

Jim Allan




Reply via email to