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

abort or verify?

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: 2004-11-10 04:29:59 CET

Julian Foad wrote:
> In most of the places where we currently say:
>
> if (blah) abort();
>
> I feel we should be saying:
>
> assert(!blah);

My reasons were:

1) Consistency: we should use one or the other, with few exceptions.
2) Informative message when the condition arises.
3) Neatness (tidiness) of source code.
4) Not checking for bugs while running a release build.

Reason (4) is strongly contested by Brane and, in case his point of view should
be dominant, I have a partial solution that achieves the rest of my aims.

Let me propose to use "verify" instead of "assert", where "verify" is defined
to be the same as "assert" except that it is always enabled (i.e. even when
NDEBUG is defined). This will achieve points (1), (2) and (3), and will leave
the checks active all the time.

Would this be acceptable to everyone?

- Julian

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Nov 10 04:30:16 2004

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.