• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 256
  • Last Modified:

VERIFY information

Hello;

I need to obtain object validation from a release version of my code.

The reason being is that a certain library that I am using in my app -that is crucial to my app- has long long function names. Longer than 256 which is VC++6.0 max debug size. Executing from a debug build produces an assertion error.

So I read up and find that VERIFY will do something about validating objects during release mode. But what? As the help section describes that VERIFY macro does not produce any printed output in release mode and has type void return??????????? So what good is it?

Any other solutions or comments apreciated.

RJ
0
RJSoft
Asked:
RJSoft
  • 2
  • 2
1 Solution
 
drichardsCommented:
Here's the definition of VERIFY:

#ifdef _DEBUG
...
#define VERIFY(f)          ASSERT(f)
...
#else   // _DEBUG
...
#define VERIFY(f)          ((void)(f))
...
#endif // !_DEBUG

As you see, in debug mode it is defined as ASSERT.  In release mode, the condition expression is left in the code.  This is useful if the calculation of the condition has side effects like changing variable values or something.  In this case you cannot simply remove the code from the release version like ASSERT does.  That is why VERIFY exists.

If you want debug information from the release version, you will have to define your own TRACE or ASSERT macros to achieve the desired functionality.
0
 
RJSoftAuthor Commented:
Hello drichards;

here's more points.

Know any examples?

I tried adjusting the debug flag. Why does this not cause assertion?

#define _DEBUG //turn on debugger flag temporary...
VERIFY(0);
#undef _DEBUG

RJ
0
 
RJSoftAuthor Commented:
My main objective is just to prove that a certain object is valid.

I have an object that is accessed by a different thread so there is some question as to it's validity. The object is a CDialog.

I see that each CObject has AssertValid function. Should I use this or the macros?


Also I would like to have a VERIFY/ASSERT equivalent for future development of my app since I can not compile cleanly with the debugger without removing the library.

RJ
0
 
drichardsCommented:
>> I tried adjusting the debug flag. Why does this not cause assertion?
Because the macro definition was loaded back in the header file.  By the time you get to your line, VERIFY is already defined as ((void)(f)) and it is too ate to change it.

If AssertValid gives you the result you need, then that is an option.  Otherwise, you'll have to write your own macro that is defined the way you need in Release mode.  With AssertValid, you may need to override it in the object you care about to behave as you want.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now