Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!asuvax!noao!arizona!robert From: robert@cs.arizona.edu (Robert J. Drabek) Newsgroups: comp.lang.c Subject: Re: NULL as a string terminator Summary: answer Message-ID: <24141@megaron.cs.arizona.edu> Date: 11 Aug 90 00:45:20 GMT References: <1990Aug7.210152.7586@arcturus.uucp> <1990Aug10.140314.12219@druid.uucp> Organization: U of Arizona CS Dept, Tucson Lines: 32 D'Arcy J.M. Cain writes: > Wade Guthrie writes: > >I have made it a practice to define a macro: > >#define EOS '\0' > Can someone explain to me what is wrong with using '\0' or even 0 when a > zero byte is required. Perhaps this is for people who get paid by the > line of code. Nothing really `wrong' with it. 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. Or maybe it's like licking your lips and rubbing your stomach instead of expressing yourself in words. (Forgive me, but it's 5:30 pm and I should be heading home for dinner.) Also, EOS is easier for me to type when changing from one keyboard to another as the ', \, and 0 often vary in position and are all further from the home row. But even if I had an abbreviation set up (in vi) I'd still like to read the EOS instead. The reason why requires maybe one last explanation which is more objective. '\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. -- -- Robert J. Drabek robert@cs.Arizona.EDU Department of Computer Science uunet!arizona!robert The University of Arizona 602 621 4326 Tucson, AZ 85721