Click to See Complete Forum and Search --> : ASSERT vs. _ASSERT vs. _ASSERTE


ALM
June 7th, 1999, 09:57 AM
I've seen some code using the ASSERT macro and other code using the _ASSERT and _ASSERTE macros. Can anyone shed some light on what their difference are and which one(s) should be used?

Thanks,
Alvaro

ChrisD
June 7th, 1999, 10:04 AM
ASSERT is an MFC macro, where as _ASSERT/_ASSERTE are defined in CRTDBG.H (C Runtime Library). _ASSERT is the same as ASSERT where as _ASSERTE will show the expression in the debug log.

HTH,
Chris

ALM
June 7th, 1999, 10:12 AM
So do you recommend I always use _ASSERTE?

ChrisD
June 7th, 1999, 11:38 AM
Using _ASSERTE generates more overhead for your Debug version because every expression in _ASSERTE needs to be stored in the exe as a string. I just use ASSERT from MFC and it gives you the file & line number which is enough information to find out where the problem is.

HTH,
Chris