On Fri, Jul 11, 2008 at 22:14, Christian Convey <christian.convey@xxxxxxxxx> wrote: > Is there any way I can make assert(...) macro invocations still do > their magic, even when I build my software for release (e.g., not with > the "-g" option)? > Using a custom assert macro is the most obvious way, probably, but you could also use a custom myassert.h header that contains something like this: #ifdef NDEBUG # define ACTUALLY_IN_NDEBUG_MODE # undef NDEBUG #end #include <assert.h> #ifdef ACTUALLY_IN_NDEBUG_MODE # define NDEBUG # undef ACTUALLY_IN_NDEBUG_MODE #endif But note that -g doesn't actually turn off asserts, so unless you're using NDEBUG explicitly, you don't need to do anything.