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

If there is more than 100 control in a window how we can change the Taborder of a controls

4 Answers   Satyam,


2.create for 10 batch: Employee_Number Employee_name Employee_Dateofjoining Employee_address Employee_salary 1.select the employee name who deriving more than 10 thousand salary and joined before august 08. use structure and pointers

0 Answers   TCS,


i have created runtime menu -- ( admistrator ->managepackage,manage module). but now i want to open a dialog when i select manage package and any other diaolg when selecting manage module ( whole selection is at run time only ) . Please HELP .its urgently required

3 Answers   Patni,


How can we create thread in MFC framework?

3 Answers  


Psychic Window Technique

2 Answers   E Logic, Wild Net,






What is the difference between regular dlls and extended dlls?

2 Answers  


1) Enable or disable a Cancel button at run time?

1 Answers   HCL,


Explain Doc/View architecture

6 Answers   Huawei,


what is message loop how mfc does it internally?

4 Answers   Aspire,


What is the difference between the Encapsulation and Abstraction

25 Answers   HCL, Invensys, TCS, Wipro,


What is LPCTSTR? What does LP denote it?

4 Answers  


How to update all the views whenver document got updated ?

1 Answers  


Categories