ASSERT vs. ATLASSERT vs. assert
Question
I am refactoring some MFC code that is littered with ASSERT
statements, and in preparation for a future Linux port I want to replace them with the standard assert
. Are there any significant differences between the two implementations that people know of that could bite me on the backside?
Similarly, I have also come across some code that uses ATLASSERT
which I would also like to replace.
Solution
No. The MFC version just includes an easy to debug break point.
OTHER TIPS
Replace them with your own assertion macro. That's how you get the most benefit out of it (logging, stack trace, etc.)
I would recommend either using your own macro, or #define's for the linux compilation. There's no compelling reason to give up any extra helpfulness on the Windows side (eg: built-in breakpoint), and no compelling reason to change a lot of code when some simple compatibility #define's will suffice.