bug-gnulib
[Top][All Lists]
Advanced

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

Re: [Bug-gnulib] hash.c change to use abort rather than assert


From: Jim Meyering
Subject: Re: [Bug-gnulib] hash.c change to use abort rather than assert
Date: Sat, 23 Nov 2002 10:42:57 +0100

Hi Paul,

coreutils supports a configure-time option called --disable-assert.
I've added assertions that end up running small, but sometimes
non-negligible amounts of code, so I like the idea of being able
to compile-out such code at the flip of a switch.  If we use the
`if (! x) abort ();' approach, then we can't do that anymore.

Of course, there's a middle ground: use an assert-like macro
that expands to `if (! x) abort ();'.

There are about 70 uses of assert in coreutils/src/*.c.
In fact, I see that factor.c has disabled all of its assertions
with this line:

#define NDEBUG 1

Jim


Paul Eggert <address@hidden> wrote:
> In Bison we recently removed all uses of 'assert' in favor of 'abort'.
> Bison uses hash.c so I installed this change into gnulib/lib/hash.c.
> If anybody feels that this is a mistake, and that we should use assert
> anyway, please let me know and I can revert the change.
>
> 2002-11-22  Paul Eggert  <address@hidden>
>
>       * hash.c: Avoid use of <assert.h>, as the GNU Coding Standards
>       hint that one should use `if (! x) abort ();' rather than `assert
>       (x);', and anyway it's one less thing to worry about configuring.
>       (hash_lookup, hash_get_first, hash_get_next, hash_find_entry,
>       hash_rehash, hash_insert): Use abort rather than assert.




reply via email to

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