use assert etc. in Wine dlls? What is better?

Joerg-Cyril.Hoehle at t-systems.com Joerg-Cyril.Hoehle at t-systems.com
Tue Mar 13 09:05:20 CDT 2012


Hi,

Maarten's wine-pulse contains several instances of assert()
I've been thinking about adding a bit of protection against
inconcsistencies within mmdevapi code too.

There are two variants that could be applicable depending on the situation:
/* this should not happen, but if we detect it early, we can work-around the situation */
if (a > limit) { ERR("%d > %d\n", a, limit); a = limit; }
or
assert(a <= limit, "whatever %d", a);

I'm not too fond of assert.  An assert in DSound was one of my first bug
fixes in Wine, years ago. It was not obvious why the app should not
continue running -- perhaps without sound.
OTOH, if an assert is violated, as a programmer, I'd like to hear about it.

I found little on that topic in Wine. In 2002, Alexandre Julliard wrote:
http://www.winehq.org/pipermail/wine-devel/2002-October/009766.html
>A better approach would be to leave assert() alone, and raise an
>exception on the SIGABRT signal.

What is current opinion on this topic?

Thank you,
 Jörg Höhle


More information about the wine-devel mailing list