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

Re: assert() vs. return(error)

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: 2006-02-15 00:03:12 CET

Garrett Rooney wrote:
> On 2/14/06, Julian Foad <julianfoad@btopenworld.com> wrote:
>>
>>That's at least the second time someone's said, "We've had a policy". I would
>>say instead, "We've had a habit." I haven't heard a good argument for this habit.
>
> It's been discussed numerous times, see the mailing list archives.

I had a quick peek in the list archives just now, but certainly not a thorough
search. From what I see and what I remember of the last couple of times this
came up, the discussions have always been the same as this one has been so far:
one camp says "assert is good" and the other says "assert is evil" and nobody
learns anything.

I take this as a brush-off and a sign that either this discussion isn't welcome
here, or I'm going about it the wrong way. Being tactless, probably; that's
what I'm good at. If anyone thinks I should take this to a more appropriate
forum, please say.

Sorry for irritating you, Garrett. I don't want to fight. I really want to
learn what the software world's best advice is on this matter, as much for my
own education as for Subversion itself.

OK, here's maybe partly where I'm going wrong: posing the question as "assert
versus error". The real issue is not that clear-cut, and maybe that subject
line tends to make people think the answer should be simply one or the other.

There are many dimensions to the issue. Public or private interface; server or
library or client program; checking parameters and/or result and/or internal
consistency; pointer or other data type; etc. The decision in each case can be
to use assert or error or no check at all, and perhaps external testing (as in
a test suite). "The best" solution, or what we should aim for if we only knew
what it was, will inevitably be a combination of techiques.

I haven't provided any answers, but hopefully the scope of the question is a
little clearer.

- Julian

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Feb 15 00:03:46 2006

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.