From: "Christian Convey" <christian.convey@gmail.com>
To: gcc-help@gcc.gnu.org
Subject: Keeping assert's active when not in debug mode?
Date: Sat, 12 Jul 2008 02:36:00 -0000 [thread overview]
Message-ID: <6addebae0807111914p6b1fbef2kddd95576c25dd8b9@mail.gmail.com> (raw)
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
next reply other threads:[~2008-07-12 2:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-12 2:36 Christian Convey [this message]
2008-07-12 4:56 ` me22
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6addebae0807111914p6b1fbef2kddd95576c25dd8b9@mail.gmail.com \
--to=christian.convey@gmail.com \
--cc=gcc-help@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).