On Mon, 12 Nov 2001, Takashi Iwai wrote:

> I agree that the function should return instead of terminate the
> program.

Yes, a library should never terminate a program - worst offender
is exit(), but assert() is the same.

> One conern is whether to put a warning/error message when an invalid
> argument is given.  It's helpful but sometime annoying.

Its annoying if you dont do a debugging session. Good error reporting
via the returnvalue is sufficient (of course the program needs to check
for errors).

> Adding another macro (like snd_assert in alsa-driver) instead of
> standard assert?  The behavior can be dependent upon the compile
> condition, i.e. with full debug message, return only, replaced with
> the normal assert macro, or even ignored.

I'd call it snd_check_arg() then - as this is the intended use. Maybe
look at the guile argument checking macros where you specify the check,
the argument position and its name. So you'd have

#define snd_check_arg(arg, arg_pos, expr, ...) ...

Maybe for really "we're lost" situations inside alsa have a snd_panic()
macro that dies with an appropriate error message (but not assert(0) like
I see in many places).

Richard.

--
Richard Guenther <[EMAIL PROTECTED]>
WWW: http://www.tat.physik.uni-tuebingen.de/~rguenth/
The GLAME Project: http://www.glame.de/


_______________________________________________
Alsa-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

Reply via email to