Alan W. Irwin wrote:
On 2007-03-14 19:50-0400 Jean-Sébastien Guay wrote:
I personally can't spot a major difference between the two (aside
from -g replaced by -O3 and NDEBUG being defined, which shouldn't
prevent it from linking).
I ran into a similar problem recently. I am no expert on NDEBUG, but
from a
superficial google search it appears it generally removes the
debugging part
of your code. In my case I had an assert statement with executed a
needed
function. NDEBUG turned that into a noop, the function call did not
occur,
and all hell broke loose. To fix the problem, the code now always
calls the
needed function, saves the return code, and only uses assert on a test of
that saved return code.
My conclusion from this experience is you have to be really careful about
how the debugging part of your code is defined before NDEBUG works
properly.
Alan,
from your description I gather that your assert statement contained a
side-effect.
You should never do that: assert is a macro that either expands to
something like:
if ( ! (code) ) {fprintf(stderr, "This code failed") ; abort(); }
or (if NDEBUG is defined) to:
(nothing)
(Which is faster than running the check and ignoring the result)
So, if there is a side effect that your program relies on, that
particular code is
not run and the side effect never takes place.
Regards,
Arjen
_______________________________________________
CMake mailing list
[email protected]
http://www.cmake.org/mailman/listinfo/cmake