xtd 0.2.0
Loading...
Searching...
No Matches
debug_cassert.cpp

Shows how to use debug::cassert method.

#include <xtd/diagnostics/debug>
#include <xtd/console>
using namespace xtd;
using namespace xtd::diagnostics;
auto main() -> int {
// Uncomment following lines to remove assert dialog
//for (auto listener : debug::listeners())
// if (is<default_trace_listener>(listener))
// as<default_trace_listener>(listener)->assert_ui_enabled(false);
auto index = 0;
console::write_line("Start application");
debug::cassert(index > 0);
console::write_line("End application");
}
// This code produces the following output :
//
// > If user clicks assert dialog 'Abort' button:
// Start application
//
// > If user clicks assert dialog 'Retry' button:
// Start application
// > Break the debugger on file debug_cassert.cpp line 12.
// > If user choose continue running after break.
// End application
//
// > If user clicks assert dialog 'Ignore' button:
// Start application
// End application
The xtd::diagnostics namespace provides classes that allow you to interact with system processes,...
Definition assert_dialog_result.hpp:10
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10