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

Re: [RFC] Replacement for "assert" in the libraries

From: Stefan Küng <tortoisesvn_at_gmail.com>
Date: Fri, 13 Jun 2008 19:27:27 +0200

Karl Fogel wrote:
> Stefan Küng <tortoisesvn_at_gmail.com> writes:
>>> * assert should only be used for "this can't happen" sanity checks
>> I disagree: assert should *never* be used, unless it's enclosed in
>> #ifdef _DEBUG statements.
>
> assert() is a no-op if NDEBUG is defined. Is NDEBUG defined in our
> production code? If not, shouldn't it be?
>

I have defined that, yes.

What worries me more than the asserts are the abort() calls - they
persist in a release build.
I just did a quick grep on the 1.5.x sourcecode. There are several
places where an abort() is used, some even have a comment describing
when that abort() will be called! I mean if that's already known, why
take down the whole application instead of returning an error?

subversion\libsvn_fs_fs\tree.c, line 782:
         default:
           abort(); /* uh-oh -- somebody didn't calculate copy-ID
                       inheritance data. */

(that's just one example, there are more)

Stefan

-- 
        ___
   oo  // \\      "De Chelonian Mobile"
  (_,\/ \_/ \     TortoiseSVN
    \ \_/_\_/>    The coolest Interface to (Sub)Version Control
    /_/   \_\     http://tortoisesvn.net

Received on 2008-06-13 19:27:49 CEST

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.