Keeping assert's active when not in debug mode?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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)?

I'd really like to keep them active, so that we can more easily detect
flaws in the released version of the software.

If I can't make assert(...) calls work, any suggestions for what to
use instead?  Maybe something like this? (I know I'd need to fix some
preprocessor issues for the macro...)

#define my_assert(predicate) {
#ifdef DEBUG
   assert(predicate);
#else
   if (! (predicate)) {
      error_at_line(1, 1, __FILE__, __LINE__, "predicate");
   }
#endif
}


Thanks,
Christian

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux