ASSER - VERIFY [modified]
-
Hello :) I have a question ? What is the advantage of writing ASSERT instead of VERIFYS ? As far as I understood, there is no need of using ASSERT, as you can use VERIFY, because it works both in Debug and Release builds and ASSERT does not work in debug builds Correct me if I am wrong. Thank you PS. I have written VERIFY(0) in my program(OnInitDialog) and built in Release mode, but it did not halt my program ?? why :confused: -- modified at 5:59 Friday 2nd June, 2006
-
Hello :) I have a question ? What is the advantage of writing ASSERT instead of VERIFYS ? As far as I understood, there is no need of using ASSERT, as you can use VERIFY, because it works both in Debug and Release builds and ASSERT does not work in debug builds Correct me if I am wrong. Thank you PS. I have written VERIFY(0) in my program(OnInitDialog) and built in Release mode, but it did not halt my program ?? why :confused: -- modified at 5:59 Friday 2nd June, 2006
big_denny_200 wrote:
As far as I understood, there is no need of using ASSERT
ASSERT or _assert is for developers to make sure there nothing wrong during the development. When he/she is sure that everything is just fine, he/she compiles it in release build. ASSERT is defined as "nothing" in release build.
Maxwell Chen
-
Hello :) I have a question ? What is the advantage of writing ASSERT instead of VERIFYS ? As far as I understood, there is no need of using ASSERT, as you can use VERIFY, because it works both in Debug and Release builds and ASSERT does not work in debug builds Correct me if I am wrong. Thank you PS. I have written VERIFY(0) in my program(OnInitDialog) and built in Release mode, but it did not halt my program ?? why :confused: -- modified at 5:59 Friday 2nd June, 2006
big_denny_200 wrote:
As far as I understood, there is no need of using ASSERT, as you can use VERIFY, because it works both in Debug and Release builds and ASSERT does not work in debug builds
the answer is there in your question. If u use VERIFY in ur project u may need to delete all assert statement which u have used for debuggin purpose. So if there is only debugging purpose, use ASSERT and if something "should not" occur in your program at any cost use VERIFY. SaRath.
"Don't Do Different things... Do Things Differently..." -
Hello :) I have a question ? What is the advantage of writing ASSERT instead of VERIFYS ? As far as I understood, there is no need of using ASSERT, as you can use VERIFY, because it works both in Debug and Release builds and ASSERT does not work in debug builds Correct me if I am wrong. Thank you PS. I have written VERIFY(0) in my program(OnInitDialog) and built in Release mode, but it did not halt my program ?? why :confused: -- modified at 5:59 Friday 2nd June, 2006
In release versions
ASSERT
evaluates to nothing. This means the statements given insideASSERT
are not executed. This could be trouble sometimes when you write statements like...int i;
ASSERT( (i=GetI()) != 0 );This statement won't execute in Release versions but will work fine in debug builds. In Release builds all statements depending on the value of 'i' will fail as the code expands to nothing. In such cases use
VERIFY
. Which executes in both versions. But will only show analert
box in the debug versions.int i;
VERIFY( (i=GetI()) != 0 );
Nibu thomas A Developer Programming tips[^] My site[^]
-
Hello :) I have a question ? What is the advantage of writing ASSERT instead of VERIFYS ? As far as I understood, there is no need of using ASSERT, as you can use VERIFY, because it works both in Debug and Release builds and ASSERT does not work in debug builds Correct me if I am wrong. Thank you PS. I have written VERIFY(0) in my program(OnInitDialog) and built in Release mode, but it did not halt my program ?? why :confused: -- modified at 5:59 Friday 2nd June, 2006
The Surviving the Release[^] article by Mr. Newcomer explains very well the difference and uses of
ASSERT
andVERIFY
macros.
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]