Assert macro setup

On Windows / C ++, I want to configure the assert dialog box to ignore the assertion forever, so I can be more aggressive with assertions. I understand how difficult it is to write the correct assert macro and I do not want to do this, just pin the dialogue code. Is there an easy way (or compressed hack) to do this?

macro-security approval article (googlecache)

update: more aggressive => use much more often for non-black errors . I want to be able to ignore the statement forever, so if a minor error statement occurs in the loop, it actually does not stop my process.

+3
source share
4 answers

Look at _ CrtSetReportHook or the new _ CrtSetReportHook2 . You can use it to set the hook, which remembers the "seen" messages and reports them as how it is processed when they saw it again.

+2
source

If "more aggressive" you mean using claims to handle errors, then you better use exceptions.

+2
source

Miro Samek:

?

, assert. ( .)

+1

, "" , , , , , bool, false.

void someFunc(...)
{
...
static bool bFireAssertion( false );

ASSERT( bFireAssertion || <your assertion test> );
...
}

, , , bFireAssertion true . , ASSERT .

0

Source: https://habr.com/ru/post/1702912/


All Articles