__assert_fail should not be __attribute__((__noreturn__))

Daniel Jacobowitz drow@false.org
Tue Apr 6 20:01:00 GMT 2004


On Tue, Apr 06, 2004 at 08:27:05PM +0200, Johannes Sixt wrote:
> On Dienstag, 6. April 2004 05:51, Richard Henderson wrote:
> > On Mon, Apr 05, 2004 at 09:23:17PM +0200, Johannes Sixt wrote:
> > > These optimization opportunities are only available if assert() is used,
> > > but NDEBUG is _not_ used. That is, the optimzed code is payed with the
> > > runtime needed to evaluate the condition.
> >
> > For now, with gcc.  Other compilers arrange for assert with NDEBUG
> > to expand to something that generates no code, yet provides the
> > compiler with the same information.  GCC may eventually do something
> > similar.
> 
> That's great.
> 
> But I am interested in the case where NDEBUG is _not_ used.
> 
> I assume the following:
> 
> - Developers know that assert() without NDEBUG produces slower code (because 
> the condition must be evaluated).
> - They use NDEBUG when they compile production code.
> 
> What is wrong with these assumptions?

Many people never use NDEBUG, and the assertions remain useful.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer



More information about the Libc-alpha mailing list