The strange mistakes brought by the front car - ISSERT 1

xiaoxiao2021-03-06  95

If one day, you find that your program has many functions that should be executed at the end of the Debug version, but it is implemented in the Release version.? Take a look at the article below will make you helpless and dark I saw a little hope.

I have encountered it today. Our project has been developed for a long time, the amount of code is very big. I have always been cautious, but suddenly, when I debug the procedure:

I put the window of the program (want to exit the program)? The result of the VC6's debug output window flashed a lot of memory leaks.? Checked, actually because the program's cwinapp :: exitInstance function I was executed. I feel strange and have always been well. Why do you suddenly do this ?? In the dark, it has been explored for a long time, and the clue only one: the program is actually normal in the Release version, cwinapp :: exitInstance has been executed.

? Because the amount of code is really large, after a long search process, it will not be fine.

....................

Finally, the reason is to use an assert (), statement in the CMAINFRAME :: ~ CMAINFRAME () function. And the condition is false. Although this assertion is triggered.

But in fact, the dialog is not bounced. Silent and interesting will give the process to Exit.

?

Slightly studied the reason later:

The Assert function will finally call an internal API (actually MessageBoxa) to pop up the assertion dialog, but if the window of all the windows of your program has dropped, this dialog can't play it ( I haven't found the reason for the time being. It seems that Microsoft is designed. Everyone knows that there are three buttons on the disclaimed dialog: abort, retry and ignore. The default is to stop, at this time because the dialog is not displayed Therefore, the system is not recognized to stop the process. This stop is forced, the system does not make any cleaning work for the object. • The structure has caused a lot of cleaning resources after the program has not been executed.

?

in conclusion:

Everyone is best not to use assertions after the main window of the program, so as not to bring inexplicable mistakes to the program. Because this error is really hard to find ^ _ ^

?

In addition, I was still surprised to discover, as long as IASERT, PEEKMESSAGE (& MSG, 0, 0, 0, 1); this sentence, the assertion dialog can be played out. The reason I have not found it yet, interested Friends don't prevent research!

?

??????????????????????????????????????????? ??????????????????????????????????????????????????? MSN: SXXNY@hotmail.com

??????????????????????????????????????????? ???????????????????????????????????? 2004-08-24

转载请注明原文地址:https://www.9cbs.com/read-123998.html

New Post(0)