[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: Kevin Pilch-Bisson <kevin_at_pilch-bisson.net>
Date: 2004-11-10 16:53:57 CET

That's pretty much what we do in Visual Studio, and it seems to work out
very well. This means that on release builds a feature may not work, but on
a debug build, you will get an assert saying why it failed.

--
~~~~~~~~~~~~~~~~~~~~
 Kevin Pilch-Bisson
~~~~~~~~~~~~~~~~~~~~
> -----Original Message-----
> From: Mark Benedetto King [mailto:mbk@lowlatency.com]
> Sent: Wednesday, November 10, 2004 7:58 AM
> To: dev@subversion.tigris.org
> Subject: Re: abort or verify?
> 
> On Wed, Nov 10, 2004 at 03:29:59AM +0000, Julian Foad wrote:
> > Julian Foad wrote:
> > >In most of the places where we currently say:
> > >
> > >  if (blah) abort();
> > >
> > >I feel we should be saying:
> > >
> > >  assert(!blah);
> >
> 
> I believe that we should always have code of the form:
> 
>     assert(!blah);
>     if (blah)
>       {
>         /* do some reasonable thing */
>       }
> 
> In some cases, that would manifest itself as:
> 
>     assert(x);
>     if (!x)
>       return svn_error_create(...);
> 
> In some cases, that would manifest itself as:
> 
>     assert(x);
>     if (!x)
>       abort();
> 
> Because the assertion generates such rich error messages,
> it should be favored over abort(), but the abort() should
> not be discarded when there is no reasonable way to proceed.
> 
> --ben
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: dev-help@subversion.tigris.org
> 
> 
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Nov 10 17:15:22 2004

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