What is the difference between the ASSERT and VERIFY macros?

Answers were Sorted based on User's Feedback



What is the difference between the ASSERT and VERIFY macros?..

Answer / muthukumar. j

Both ASSERT and VERIFY macros behave in the same Manner in
debug Version.

But in Release version the Expression in the ASSERT is
ignored. And in Release version the Expression in the
VERIFY is evaluated. But not verified. Means the expression
is evaluated. And like dubug it is NOT stop the execution
if the expression evaluated to FALSE.

Is This Answer Correct ?    16 Yes 0 No

What is the difference between the ASSERT and VERIFY macros?..

Answer / ctharam

ASSERT:-
--------
This function is available only in the Debug version of MFC.

Ctharam* tharamage = new Ctharam(21); //Ctharam is derived from CObject.
ASSERT(tharamage != NULL);
ASSERT(tharamage ->IsKindOf(RUNTIME_CLASS(Ctharam)));
// Terminates program only if tharamage is NOT a Ctharam*.


VERIFY:-
-------
1)
In the Debug version of MFC, evaluates its argument.

ex:- VERIFY(booleanExpression )

2)

In the Release version of MFC, VERIFY evaluates the expression

Ex:-
// get the display device context
HDC hdc;
VERIFY((hdc = ::GetDC(hwnd)) != NULL);

// give the display context back
::ReleaseDC(hwnd, hdc);

Is This Answer Correct ?    1 Yes 0 No

What is the difference between the ASSERT and VERIFY macros?..

Answer / satyabrata mishra

ASSERT() macro works in the Debug builds
VERIFY() macro works in Release builds.

Is This Answer Correct ?    2 Yes 10 No

What is the difference between the ASSERT and VERIFY macros?..

Answer / manoj

ASSERT for Debug.
Verify for Release

Is This Answer Correct ?    1 Yes 10 No

Post New Answer

More MFC Interview Questions

How do you change the properties for a tree view control that is part of the CTreeView class?

1 Answers  


What is LoadLibrary function returns?

7 Answers  


What is document-view architecture ? Give me one real time example for SDI ?

2 Answers  


how to give colour for dialog button or static buuto?any one explain full code ?pls pls

3 Answers  


What is thread & process?

15 Answers   Exaband,






What is the base class for MFC Framework ?

2 Answers   Mphasis,


I want recent paper pattern for HP company?

0 Answers   HP,


if i modified data in 1 view how does the other view knows

2 Answers   Siemens,


How we can findout Memoryleaks, In what way it can be avoided

6 Answers   Infosys,


Why not virtual functions to handle messages?

5 Answers  


Tell me the work of HTREDUCE and HTZOOM

1 Answers   E Logic,


1)dynamic creation of a Button ?

2 Answers   TCS,


Categories