digitalmars.D.learn - Assert question
- DLearner (7/7) Jul 26 2016 Suppose a program contains several points that control should not
- Steven Schveighoffer (6/11) Jul 26 2016 In non-release mode, assert(0, msg) prints the message (an error is
- Adam D. Ruppe (6/8) Jul 26 2016 If you compile with -g, run the program in a debugger. It will
Suppose a program contains several points that control should not get to. So each such point is blocked by assert(0). What is the recommended way of identifying which assert has been triggered? Is one allowed anything like 'assert(0,"Crashed at point A");', where the message goes to stderr?
Jul 26 2016
On 7/26/16 8:13 AM, DLearner wrote:Suppose a program contains several points that control should not get to. So each such point is blocked by assert(0). What is the recommended way of identifying which assert has been triggered? Is one allowed anything like 'assert(0,"Crashed at point A");', where the message goes to stderr?In non-release mode, assert(0, msg) prints the message (an error is thrown). In release mode, the assert(0) halts the program immediately and does not print any message. So yes and no :) -Steve
Jul 26 2016
On Tuesday, 26 July 2016 at 12:13:02 UTC, DLearner wrote:What is the recommended way of identifying which assert has been triggered?If you compile with -g, run the program in a debugger. It will tell you. If you compile and do NOT use -release, the error message automatically printed by the assert will tell you the line number on the first line of output.
Jul 26 2016