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

Shows how to use trace::cassert_ method.

#define TRACE
#include <xtd/diagnostics/trace>
#include <xtd/console>
using namespace xtd;
using namespace xtd::diagnostics;
auto main() -> int {
// Uncomment following lines to remove assert dialog
//for (auto listener : trace::listeners())
// if (is<default_trace_listener>(listener))
// as<default_trace_listener>(listener)->assert_ui_enabled(false);
auto index = 0;
console::write_line("Start application");
trace::cassert(index > 0, "index must be greater than 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 tace_cassert.cpp line 13.
// > 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