public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Keeping assert's active when not in debug mode?
@ 2008-07-12  2:36 Christian Convey
  2008-07-12  4:56 ` me22
  0 siblings, 1 reply; 2+ messages in thread
From: Christian Convey @ 2008-07-12  2:36 UTC (permalink / raw)
  To: gcc-help

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-07-12  2:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-12  2:36 Keeping assert's active when not in debug mode? Christian Convey
2008-07-12  4:56 ` me22

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).