www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2001/10/29/15:05:01

Date: Mon, 29 Oct 2001 15:03:45 -0500
Message-Id: <200110292003.f9TK3jk09782@envy.delorie.com>
From: DJ Delorie <dj AT delorie DOT com>
To: djgpp-workers AT delorie DOT com
In-reply-to: <3BDD0D9A.A26EF8CC@phekda.freeserve.co.uk> (message from Richard
Dawe on Mon, 29 Oct 2001 08:04:42 +0000)
Subject: Re: Assertions in library code?
References: <3BDD0D9A DOT A26EF8CC AT phekda DOT freeserve DOT co DOT uk>
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> What is the position on using assert in library code? (I'll update the
> knowledge base development section with the answer.)

In libc?  I would think that in most of the cases where you would want
an assertion, what you really want is an error check and to return an
error code.  If a bad thing *can* happen, we need to deal with it, not
just hope it doesn't happen.

Normally with assert.h, you would build final versions with -DNDEBUG
to take out the assertion checks.  I think you end up with something
that isn't tested as well as it should be, because now the code is
different.

But I'd have to see the specific cases to decide.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019