|
From: jo m. <non...@ho...> - 2003-10-10 10:04:13
|
I don't know what you mean by "compiling in debug mode", but if you want the
"assertions" not to be compiled I think you should
#define NDEBUG
either in the source code or trough the command line.
I hope it helps.
>From: Wobien <wo...@pl...>
>Reply-To: Wobien <wo...@pl...>
>To: dev-cpp-users-list <dev...@li...>
>Subject: [Dev-C++] using assert
>Date: Thu, 09 Oct 2003 16:27:45 +0200
>
>Using assert is supposed to be a big help in finding bugs in your program.
>
>#include <cassert>
>assert(a<b);
>
>should stop your program if a>=b and print the file and line number of the
>assert statement that failed, if and only if you run in debug mode. If you
>are not in debug mode, the assert statements should not be compiled.
>
>Now I have 2 problems:
>
>1: my program stops if the assert fails, even if I did not compile in the
>debug mode.
>
>2: when the program stops it does not wait and stop to give me the
>opportunity to read the message about the file and line number. The system
>("PAUSE"); statement at the end of the main procedure does not help here,
>because the program never gets there.
>
>A simple test "program" to try this is:
>
>#include <stdlib.h>
>#include <cassert>
>int main()
>{
> int a=5;
> int b=1;
> assert(a<b);
> system ("PAUSE");
> return 0;
>}
>
_________________________________________________________________
Help STOP SPAM with the new MSN 8 and get 2 months FREE*
http://join.msn.com/?page=features/junkmail
|