[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Findutils-patches] [PATCH] Include sys/stat.h in files where we use

From: Bob Proulx
Subject: Re: [Findutils-patches] [PATCH] Include sys/stat.h in files where we use struct stat.
Date: Tue, 26 Jun 2007 13:58:39 -0600
User-agent: Mutt/1.5.9i

Eric Blake wrote:
> James Youngman wrote:
> > I agree with you on the issue of NULL, but I am in firm diagreement on
> > the issue of '\0'.   As I am sure you know, in C the type of '\0' is
> > int, not char.   Hence '\0' and 0 are of the same type and have the
> > same value.  Choice between them is essentially stylistic.
> > 
> > But I have found in the past that typos are a frequent source of bugs.
> >  The best-known case of this is the accidental change of '==' to '='.
> >  However, in this case a typo can change '\0' to '0', introducing a
> > bug.  For this reason I prefer to use 0 rather than '\0' because the
> > former isn't vulnerable to bugs introduced as typos.
> You provide a nice argument.  Maybe it's worth documenting that in the
> findutils maintainers note, since the GNU Coding Standards are silent on
> preference between 0 and '\0'.

My opinion here is, of course, not of value but I also always prefer 0
over '\0' in C code for similar reasons.  However I also always prefer
0 over NULL too.  :-)  Zero is one of the few magic numbers and I
prefer not seeing it obfuscated with a macro.

Just my two cents...


reply via email to

[Prev in Thread] Current Thread [Next in Thread]