[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r31583 - trunk/subversion/libsvn_wc

From: Stefan Sperling <stsp_at_elego.de>
Date: Wed, 4 Jun 2008 22:06:11 +0200

On Wed, Jun 04, 2008 at 08:30:48PM +0100, Philip Martin wrote:
> To my eye strcmp() == 0 is as ugly as the construct 5 == x; I find
> !strcmp() is as natural as !ptr. entries.c used both strcmp styles
> and ! form was dominant so at least one other developer must agree
> with me. I realise styles change; years ago when I started writing C
> the people I worked with would only ever have written strcmp() == 0 if
> it was mixed with strcmp() > 0 or strcmp() < 0.

In my mind, ! is a boolean operator, and strcmp() does not return
a boolean value:

RETURN VALUES
     The strcmp() and strncmp() return an integer greater than, equal to, or
     less than 0, according as the string s1 is greater than, equal to, or
     less than the string s2.

For pointers, ! makes sense -- the pointer is either valid or it isn't.

> Writing strcmp() == 0
> on it's own it would probably have attracted comments referring to
> Pascal, or Modula2, and the subsequent debate would inevitably include
> "of course a real programmer would use FORTRAN".

Heh. When I started programming, many people had already forgotten
that these languages ever existed :)

Stefan

  • application/pgp-signature attachment: stored
Received on 2008-06-04 22:06:29 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.