Как проигнорировать assert ?
От: overt Ниоткуда  
Дата: 19.11.08 11:15
Оценка:

When the application is linked with a debug version of the run-time libraries, assert creates a message box with three buttons: Abort, Retry, and Ignore. If the user clicks Abort, the program aborts immediately. If the user clicks Retry, the debugger is called and the user can debug the program if just-in-time (JIT) debugging is enabled. If the user clicks Ignore, assert continues with its normal execution: creating the message box with the OK button. Note that clicking Ignore when an error condition exists can result in undefined behavior.

Языками не владею, поэтому мог неверно понять вышесказанное. Т.е. из этого мне совершенно не ясно, как должно вести себя консольное приложение со сработавшим assert() в _DEBUG сборке при нажатии кнопки Ignore. В действительности само окошко с кнопкой Ingore вызывается из ф-ии abort(), так что шансов на продолжение выполнения программы уже нет. В случае Ignore в консоль выводится дополнительное сообщение:

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

после чего приложение благополучно завершается через _exit(3) в конце ф-ии abort().
Если нажать Abort, приложение завершается без дополнительных сообщений в глубинах abort...__crtMessageWindow(), тоже вызвовом _exit(3).

В чем тогда суть Ignore, если я не могу проигнорировать сработавший assert() ??
(MS VS 7.1/8.0)
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.