Main Page   Reference Manual   Namespace List   Compound List   Namespace Members   Compound Members   File Members  

Macros
Fatal Debug Output
Collaboration diagram for Fatal Debug Output:

Macros

#define DoutFatal(cntrl, data)
 Macro for writing fatal debug output to the default debug object libcw_do .
 

Detailed Description


Detailed Description

Often an application needs to be terminated when a fatal error occurs (whether or not CWDEBUG is defined).  Libcwd defines for these cases the macro DoutFatal.This allows you to write
if (error)
DoutFatal(dc::core|error_cf, "An error occurred");
control_flag_t const error_cf
Append error string according to errno.
Definition: control_flag.h:62
fatal_channel_ct core
Definition: debug.cc:537
#define DoutFatal(cntrl, data)
Macro for writing fatal debug output to the default debug object libcw_do .
Definition: debug.h:164
instead of the equivalent
if (error)
{
Dout(dc::core|error_cf, "An error occurred");
std::cerr << "An error occurred" << std::endl;
exit(254);
}
#define Dout(cntrl, data)
Macro for writing debug output.
Definition: debug.h:154
The big difference with Dout is that DoutFatal is not replaced with white space when the macro CWDEBUG is not defined.There are two debug channels that can be used together with DoutFatal: dc::fatal and dc::core .  The first terminates by calling exit(254), the second terminates by raising SIGABORT, causing the application to core dump.
See also
Predefined Debug Channels
Control Flags
Defining your own debug objects
Copyright © 2001 - 2004 Carlo Wood.  All rights reserved.