On Sun, 24 May 1998, Andrea Arcangeli wrote:

> On Sat, 23 May 1998, Glynn Clements wrote:
> 
> >Personally, I avoid using `!strcmp(...)'; I find `strcmp(...) == 0' to
> >be more intuitive.
> 
> __Personally__ I like the opposite ;-). I always use ! when I can.  It' s
> faster and nicer. 

Don't be fooled!  Just because it looks smaller in your c source, it
doesn't mean it'll be faster.  It *should* generate the same code, so the
only reason to use one way over another is code readability.  IMHO, I
think that Glynn's code is more readable, since it helps you realise that
the condition will be true if the strings are equal.  Similarly for
checking of error conditions or null pointers, I think that a compare with
zero makes c code much more readable. (of course this is just my 2c which
ain't worth much since the smallest unit of currency here is 5c :)

Can you explain why you think it is "nicer", please?

> 
> Andrea[s] Arcangeli
> 

Pete

Pete Ryland     Home phone: +61 2 9697 9262     Mobile: 014 035 802
email: [EMAIL PROTECTED]  ICQ UIN: 4256333
WWW: http://www.pdr.ml.org      ftp: ftp.pdr.ml.org

Reply via email to