[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: Branko Čibej <brane_at_xbc.nu>
Date: Wed, 04 Jun 2008 23:00:41 +0200

Stefan Sperling wrote:
> 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.
>

I can think of several billion pointer values that are invalid and yet
not NULL.

And it strikes my that far too much effort is being spent on stylistic
nits lately. Yes, consistent style is important, but working code is
more important.

To misquote some US president, if you can't read the code, get out of
the project.

>> 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 :)
>

Yes, I assumed as much.

-- Brane

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-06-04 23:01:24 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.