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

Re: svn commit: r14041 - in trunk/subversion: libsvn_ra_dav mod_dav_svn tests/clients/cmdline

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: 2005-04-12 02:29:25 CEST

kfogel@collab.net wrote:
> cmpilato@tigris.org writes:
>>+ if (! ((cdata = string_from_cdata_pieces(child, resource->pool))))
>>+ return empty_cdata_error(child->name, resource->pool);
> Is it just me, or is there an extra level of paren-wrapping going on here?
>>+ if ((derr = dav_svn__test_canonical(cdata->data,
>>+ resource->pool)))
> And here.

>> if ((serr = svn_repos_begin_report(&rbaton, revnum, repos->username,
>> repos->repos,
>> src_path, target,
> Hmm, I see from the context that this paren thing is some sort of
> quaint local custom. Forget I mentioned it.

There is a (fairly) well known practice of putting an extra level of
parentheses around an assignment that is the whole test expression in an "if",
"while", etc., to indicate that, yes, it was intentionally an assignment rather
than a typo for an equality test. Some compilers co-operate with this
practice, giving a warning about assignment within a test only if it is not
within extra parentheses. (I think.)

However, that only accounts for some of the instances that you pointed out -
e.g. the second but not the first of those I quote above. The first one (and
all those starting with "not" ("!")) does not need extra parentheses, because
this practice does not apply to sub-expressions, only to the outer expression
that is the whole test. (I think.)

- Julian

To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Apr 12 02:30:12 2005

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