File: fatal_output.dox

package info (click to toggle)
libcwd 1.0.4-1.1
  • links: PTS
  • area: non-free
  • in suites: jessie, jessie-kfreebsd
  • size: 8,136 kB
  • ctags: 10,313
  • sloc: cpp: 23,354; sh: 9,798; ansic: 1,172; makefile: 852; exp: 234; awk: 11
file content (45 lines) | stat: -rw-r--r-- 1,183 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/*!
\defgroup group_fatal_output Fatal Debug Output
\ingroup book_writing
*/
/*!
\page page_fatal_output
\ingroup group_fatal_output

<hr><h2>Detailed Description</h2>

Often an application needs to be terminated when a fatal error occurs (whether or not CWDEBUG
is defined).&nbsp; Libcwd defines for these cases the macro DoutFatal.

This allows you to write

\code
if (error)
  DoutFatal(dc::core|error_cf, "An error occurred");
\endcode

instead of the equivalent

\code
if (error)
{
  Dout(dc::core|error_cf, "An error occurred");
  std::cerr << "An error occurred" << std::endl;
  exit(254);
}
\endcode

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:
\link libcwd::channels::dc::fatal dc::fatal \endlink and
\link libcwd::channels::dc::core dc::core \endlink.&nbsp;
The first terminates by calling <CODE>exit(254)</CODE>,
the second terminates by raising SIGABORT, causing the application to core dump.

\sa \ref group_default_dc
 \n \ref group_control_flags
 \n \link chapter_custom_do Defining your own debug objects \endlink

*/