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

Re: [PATCH]: tentative fix for libsvn_ra_dav request_auth-bug (issue 1005)

From: Marcus Comstedt <marcus_at_mc.pp.se>
Date: 2002-11-22 21:56:12 CET

Blair Zajac <blair@orcaware.com> writes:

> Just as an FYI, a lot of developers I work with like to use
>
> (NULL == foo)
>
> instead, that way if you forget one '=' then the code becomes a compile
> error instead of an assignment of NULL to foo. I'm well aware that gcc
> warns you about this kind of assignment in a if (), but it's still a
> good practice that I use.

Unfortunately, it also looks uglier. I use that kind of
construction only for one thing: *scanf(). i.e.:

  (4 == sscanf(buf, "%d %d %d %d", ...))

The reason then is then of course not of fear of typing "=" instead of
"==" (apart from the fact that I never do that ( :-) ), you can't
assign something to a function call anway), but just to move the 4
closer to the format string (since the ... part tends to get pretty
long for large values of "4").

I don't know why, but I just find it terribly ugly with constants on
the left hand side of comparison operators. I _know_ what the
constant is, so I don't need a comparison operator to find out. ;-)

  // Marcus

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Nov 22 21:57:33 2002

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.