Path: utzoo!attcan!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!uwm.edu!rutgers!cbmvax!blekko!skrenta From: skrenta@blekko.UUCP (Rich Skrenta) Newsgroups: comp.lang.c Subject: Re: NULL as a string terminator Message-ID: <134@blekko.UUCP> Date: 11 Aug 90 15:18:00 GMT References: <24141@megaron.cs.arizona.edu> Organization: BlekkoTek World Headquarters, Frazer, PA, USA Lines: 35 robert@cs.arizona.edu (Robert J. Drabek) writes: >>> #define EOS '\0' > I see the difference as one between > using an object and using a name for the object. My personal feeling is > that it is more polite to use the name. > '\0' has uses and interpretations other than "end-of- > string". So when I see EOS I know for certain what I meant. When I see > '\0' there is the chance that some other interpretation or use is meant. In many cases the object itself becomes familiar enough that it's instantly recognized. '\0' is one such object. If I saw in your code *p = EOS; I'd have to run off to your .h files to find the definition of EOS. *You* like your non-standard name for '\0', but no one else will know what it means, and it's unlikely that it will ever be a Big Win for you (like if we start terminating strings with ^A or something). Other cases occur where someone makes #defines for error strings that are used only once: #define FOO_BAR_ERROR "foo bar error" #define UNDEF_BAZ_ERR "undef baz err" I cringe when I come across code like this. Needlessly removing objects a level is distracting and gains nothing. Rich -- skrenta@blekko.commodore.com