News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

NDEBUG and Release Build target

Started by rhf, July 27, 2007, 05:18:04 PM

Previous topic - Next topic

rhf

Hi,

I frequently use assert() in my code development and was surprised when I got asserts in my Release build.
I guess I was expecting NDEBUG to be defined by default when building a Release build.
This is easy enough to fix on a project basis with Project->Build options->Release-># defines tab.
However, I would like to set this globally for all my Release builds.
In Settings->Compiler and debugger settings->Global compiler settings, I don't see how to distinguish Debug and Release targets.

Am I overlooking something?

Thanks.

killerbot

our project wizards probably should take this issue into account.
will assert be gone with NDEBUG in all compilers, or is it different per compiler (GCC, MS, ...)

rhf

Quote from: killerbot on July 27, 2007, 06:52:51 PM
will assert be gone with NDEBUG in all compilers, or is it different per compiler (GCC, MS, ...)

Assert() is brought in with 'include <cassert>' (or <assert.h> in c).
It is a standard c function (or maybe macro in some implementations), so I assume that compliant C++ compilers support it.
By default the MS Visual C 6 IDE defines NDEBUG when building a Release version.
This is what I was expecting - or at least as a user option.
Thanks,

thomas

Yep, it's a standard feature that should probably be set up by the wizards.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."