On Mon, 12 Nov 2001, Abramo Bagnara wrote:

> None of the asserts should be generated on a bogus input from user and
> if this is not true this *IS* a bug and need to be fixed.

I see the following code in a lot of places in current CVS (I did not
check current cvs before my first mail, but relied on 0.9beta5 (or was
it 6?) which asserted on illegal names in snd_pcm_open()....):

   if (some error condition) {
        assert(0);
        return -EWHATEVER;
   }

What do you expect from such code!?? Or I see code like

   err = some_function();
   assert(err >= 0);

?? Either this assert belongs into some_function, or you should
pass up this error - because either its an error you are able
to handle, or its an implementation bug in which case the assert
is correct. Also using assert(0)'s on the default branch of a
switch statement looks bogous - think of programs compiled against
a new alsa-lib using an old one without say a new enum of any
kind -- boom (without a good reason, and without a good hint to
the user either - "assertion 0 failed" is truely helpful).

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