Hi,

There are cases where compile time evaluated asserts would be nice.
Let me give an example:

src/decoder/wavpack_plugin.c:74: assert(sizeof(uchar) <= sizeof(uint32_t));

We know that this assert will be always true, but it is there to
remind developers to look at what they are doing near that part. This
kind of asserts always induce comments which explains their role.
My point is, using the pure assert() macro there may produce unneeded
run-time checks which can be avoided nicely. The following document
describes what I am talking about, and suggests several possible
solutions:
http://pera-software.com/articles/compile-time-assertions.pdf

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.

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

Reply via email to