|
-
January 22nd, 2003, 04:18 AM
#1
A question about the precompiled directive ASSERT
Hi, everyone!
Please look at the following code,
--------
#if ASSERT
sprintf (s, "_Assert: %s, %d",__FILE__, __LINE__ );
#else
//...
#endif
--------
I want to know where is the precompiled directive ASSERT defined?
Is it compiler system defined variable? What is the meaning and
function of it?
Thanks in advance,
George
-
January 22nd, 2003, 07:29 AM
#2
It depends on your compiler; it's my understanding that ASSERT
isn't part of the C standard so using it might be nonportable
[as opposed to assert(), which should be portable]. Anyway,
in my compiler, ASSERT is #define'd in crtdbg.h, afx.h, and I'm sure
it's #define'd other ways in other places as well. Do a grep or
similar search through your compiler's header files and find out
for yourself where it'll be #define'd on your system.
--Paul
-
January 22nd, 2003, 08:29 AM
#3
Thanks!
George
Originally posted by PaulWendt
It depends on your compiler; it's my understanding that ASSERT
isn't part of the C standard so using it might be nonportable
[as opposed to assert(), which should be portable]. Anyway,
in my compiler, ASSERT is #define'd in crtdbg.h, afx.h, and I'm sure
it's #define'd other ways in other places as well. Do a grep or
similar search through your compiler's header files and find out
for yourself where it'll be #define'd on your system.
--Paul
-
January 23rd, 2003, 11:28 PM
#4
Moreover, ASSERT is a non-standard Microsoft MFC substitution for standard C assert macro. Nota bene, ASSERT is in effect only when the MFC macro _DEBUG defined, opposed to assert, which depends on the standard NDEBUG macro.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|