summaryrefslogtreecommitdiff
path: root/libstdc++-v3/doc/html/manual/debug_mode.html
blob: f35960b53b742be38f10abcd21275e7c49537c28 (plain)
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
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Chapter 17. Debug Mode</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.76.1"/><meta name="keywords" content="&#10;      C++&#10;    , &#10;      library&#10;    , &#10;      debug&#10;    "/><meta name="keywords" content="&#10;      ISO C++&#10;    , &#10;      library&#10;    "/><link rel="home" href="../spine.html" title="The GNU C++ Library"/><link rel="up" href="extensions.html" title="Part III.  Extensions"/><link rel="prev" href="ext_compile_checks.html" title="Chapter 16. Compile Time Checks"/><link rel="next" href="bk01pt03ch17s02.html" title="Semantics"/></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 17. Debug Mode</th></tr><tr><td align="left"><a accesskey="p" href="ext_compile_checks.html">Prev</a> </td><th width="60%" align="center">Part III. 
  Extensions
  
</th><td align="right"> <a accesskey="n" href="bk01pt03ch17s02.html">Next</a></td></tr></table><hr/></div><div class="chapter" title="Chapter 17. Debug Mode"><div class="titlepage"><div><div><h2 class="title"><a id="manual.ext.debug_mode"/>Chapter 17. Debug Mode</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl><dt><span class="section"><a href="debug_mode.html#manual.ext.debug_mode.intro">Intro</a></span></dt><dt><span class="section"><a href="bk01pt03ch17s02.html">Semantics</a></span></dt><dt><span class="section"><a href="bk01pt03ch17s03.html">Using</a></span></dt><dd><dl><dt><span class="section"><a href="bk01pt03ch17s03.html#debug_mode.using.mode">Using the Debug Mode</a></span></dt><dt><span class="section"><a href="bk01pt03ch17s03.html#debug_mode.using.specific">Using a Specific Debug Container</a></span></dt></dl></dd><dt><span class="section"><a href="bk01pt03ch17s04.html">Design</a></span></dt><dd><dl><dt><span class="section"><a href="bk01pt03ch17s04.html#debug_mode.design.goals">Goals</a></span></dt><dt><span class="section"><a href="bk01pt03ch17s04.html#debug_mode.design.methods">Methods</a></span></dt><dt><span class="section"><a href="bk01pt03ch17s04.html#debug_mode.design.other">Other Implementations</a></span></dt></dl></dd></dl></div><div class="section" title="Intro"><div class="titlepage"><div><div><h2 class="title"><a id="manual.ext.debug_mode.intro"/>Intro</h2></div></div></div><p>
    By default, libstdc++ is built with efficiency in mind, and
    therefore performs little or no error checking that is not
    required by the C++ standard. This means that programs that
    incorrectly use the C++ standard library will exhibit behavior
    that is not portable and may not even be predictable, because they
    tread into implementation-specific or undefined behavior. To
    detect some of these errors before they can become problematic,
    libstdc++ offers a debug mode that provides additional checking of
    library facilities, and will report errors in the use of libstdc++
    as soon as they can be detected by emitting a description of the
    problem to standard error and aborting the program.  This debug
    mode is available with GCC 3.4.0 and later versions.
  </p><p>
    The libstdc++ debug mode performs checking for many areas of the
    C++ standard, but the focus is on checking interactions among
    standard iterators, containers, and algorithms, including:
  </p><div class="itemizedlist"><ul class="itemizedlist"><li class="listitem"><p><span class="emphasis"><em>Safe iterators</em></span>: Iterators keep track of the
    container whose elements they reference, so errors such as
    incrementing a past-the-end iterator or dereferencing an iterator
    that points to a container that has been destructed are diagnosed
    immediately.</p></li><li class="listitem"><p><span class="emphasis"><em>Algorithm preconditions</em></span>: Algorithms attempt to
    validate their input parameters to detect errors as early as
    possible. For instance, the <code class="code">set_intersection</code>
    algorithm requires that its iterator
    parameters <code class="code">first1</code> and <code class="code">last1</code> form a valid
    iterator range, and that the sequence
    [<code class="code">first1</code>, <code class="code">last1</code>) is sorted according to
    the same predicate that was passed
    to <code class="code">set_intersection</code>; the libstdc++ debug mode will
    detect an error if the sequence is not sorted or was sorted by a
    different predicate.</p></li></ul></div></div></div><div class="navfooter"><hr/><table width="100%" summary="Navigation footer"><tr><td align="left"><a accesskey="p" href="ext_compile_checks.html">Prev</a> </td><td align="center"><a accesskey="u" href="extensions.html">Up</a></td><td align="right"> <a accesskey="n" href="bk01pt03ch17s02.html">Next</a></td></tr><tr><td align="left" valign="top">Chapter 16. Compile Time Checks </td><td align="center"><a accesskey="h" href="../spine.html">Home</a></td><td align="right" valign="top"> Semantics</td></tr></table></div></body></html>