[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: new thread test: error printing - fix
From: |
Niels Möller |
Subject: |
Re: new thread test: error printing - fix |
Date: |
26 Nov 2002 18:57:04 +0100 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 |
Michal 'hramrach' Suchanek <hramrach_l@centrum.cz> writes:
> static void
> entry_point (void *(*start_routine)(void *), void *arg)
> {
> + assert (uselocale (LC_GLOBAL_LOCALE) == 0);
> pthread_exit (start_routine (arg));
> }
That's a misuse of assert. You should never depend on sideeffects in
an asserted expression (and preferable that should be no side-effects
at all).
if (uselocale (LC_GLOBAL_LOCALE) != 0)
abort();
is better if you don't need any fancier error handling. Even if no
sane person will compile with NDEBUG, you should still make sure that
the code behaves the same way if assert(x) expands into nothing.
I also think Roland have made related bugfixes on glibc recently, you
may want review the mailing list archives and/or glibc cvs.
/Niels