bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help with create_pipe_bidi


From: Akim Demaille
Subject: Re: Help with create_pipe_bidi
Date: Mon, 7 Sep 2009 08:03:01 +0200


Le 6 sept. 2009 à 01:32, Joel E. Denny a écrit :

I feel uncomfortable with the fact that aver is silent, so I'd prefer that aver == assert in !NDEBUG mode, and becomes the original aver implementation
otherwise.  Something like:

/* <assert.h>'s assertions are heavyweight and can be disabled too
 easily, but deliver more information on failure.  So use aver.  See
 discussions at
<http://lists.gnu.org/archive/html/bison-patches/2006-01/msg00080.html > <http://lists.gnu.org/archive/html/bison-patches/2006-09/msg00111.html >.
 */
#if defined NDEBUG
static inline void
aver (bool assertion)
{
if (! assertion)
  abort ();
}
#else
# include <assert.h>
# define aver assert
#endif

So how useful would --disable-asserts be for Bison? Is our goal to hide
these debugging messages from the end user but not really remove the
run-time cost?  If not, then maybe aver should just implement assert
without allowing NDEBUG to affect it.

I can understand the concerns of Paul wrt the space-footprint of assert, that's why I meant to twist the meaning of NDEBUG into "smaller foot-print". I would make --disable-asserts equivalent to NDEBUG, so it would move from classical assert to our current aver.

We can also provide a three-state --disable-asserts:

- yes: fully blown assert,
- no: our current aver, same as NDEBUG,
- totally: completely remove the assertions.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]