Hi, 2008/11/22 Max Kellermann <[EMAIL PROTECTED]>: > On 2008/11/21 21:29, Kodest <[EMAIL PROTECTED]> wrote: >> I think we should consider using this at least where I pointed in the >> wavpack plug-in, but maybe there are more places in the mpd code where >> assert()s could be replaced by assert_static()s, or where >> assert_static()s could be introduced. So, assert_static() should be >> defined in a common header file. >> >> Tell me if we have already a solution to this problem. > > We don't have that currently, but it sounds like a good idea. Keep in > mind that assertions don't generate any machine code with -DNDEBUG, so > the advantage over "real" assert() is very small in this regard; it's > however useful because you don't have to execute the code to see the > error. But if you see places where a compile-time assertion is more > useful, why not. I'll accept patches.
I have two patches, both of them can be found in my repo. 457a6f4b utils: introduce assert_static() a493aafe wavpack: use assert_static() I tested it with gcc-4.1.2. Good case warnings/errors: none Bad case warnings/errors: decoder/wavpack_plugin.c: In function 'format_samples_int': decoder/wavpack_plugin.c:75: warning: division by zero decoder/wavpack_plugin.c:75: error: enumerator value for 'assert_static__' is not an integer constant This is not the nice "Assertion failed ..." message, but it refers to assert_static, so the situation can be figured out. Please comment. Regards, Kodest ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Musicpd-dev-team mailing list Musicpd-dev-team@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team