Assert does not display error message

I had a strange problem with assert in Visual C ++ 2005. I tried to submit statements to my program, and regardless of what I am trying to use (assert () or BOOST_ASSERT_MSG), it gives the same error message which nothing tells me that a debugging error has occurred.

Debug error!

Program:...

This application asked Runtime to terminate it in an unusual way. For more information, contact support.

(Click Retry App Debugging)

Here is the boost statement that I am using

BOOST_ASSERT_MSG(deathRow.size() >= 3, "There are less than 3 blocks being deleted!"); 

And yes, this gives the same error message:

 assert(deathRow.size() >= 3 && "There are less than 3 blocks being deleted"); 

An incorrect error occurs no matter which project I use, new or old.

I have no idea why. I know that I used to use statements in another program and did not have this problem. Help will be appreciated.

+4
source share
1 answer

If you are using the Microsoft _ASSERTE macro (note E for expression), then a message will also appear in the confirmation dialog.

The reason why both versions of ASSERT exist, is because both have advantages and disadvantages, and you can choose what you want.

  • _ASSERTE gives better diagnostics, but results in slightly larger binaries (since the textual representation of the expression should be included in the binary)
  • _ASSERT provide less information in the assert dialog box, but the result is smaller binaries.

Since both options only generate code in the debug assembly, I usually use _ASSERTE because the size of the binary is unlikely to be executed and does not really matter in debug builds.

+6
source

All Articles