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

Re: abort or verify?

From: Peter S. Housel <housel_at_acm.org>
Date: 2004-11-11 02:15:21 CET

At Wed, 10 Nov 2004 16:44:53 -0700, Justin Erenkrantz wrote:
>
> --On Thursday, November 11, 2004 1:19 AM +0100 "Branko ?ibej"
> <brane@xbc.nu> wrote:
>
> >> I'm not sure how you'd have it defined to be the same. The expansion
> >> of assert() is different on each platform, IIRC.
> >
> > Yes, but the following would almost do the trick:
> >
> > #define verify(x) do { assert(x); if (!(x)) abort(); } while(1)
>
> But, you'd incur a double penalty when assert is defined. That's badness,
> IMHO. -- justin

Not a big problem. Most compilers are capable of removing the
redundant comparison, provided the x expression doesn't contain any
side-effects.

-Peter-

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Nov 11 02:15:47 2004

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