Merge from mainline (160224:163495).
[official-gcc/graphite-test-results.git] / libstdc++-v3 / doc / html / manual / support.html
blobf514c97aade0e65994824502bb246d4aff7a0385
1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 4.  Support</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.2" /><meta name="keywords" content="&#10; ISO C++&#10; , &#10; library&#10; " /><link rel="home" href="../spine.html" title="The GNU C++ Library Documentation" /><link rel="up" href="bk01pt02.html" title="Part II.  Standard Contents" /><link rel="prev" href="bk01pt02.html" title="Part II.  Standard Contents" /><link rel="next" href="dynamic_memory.html" title="Dynamic Memory" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 4
4 Support
6 </th></tr><tr><td width="20%" align="left"><a accesskey="p" href="bk01pt02.html">Prev</a> </td><th width="60%" align="center">Part II. 
7 Standard Contents
8 </th><td width="20%" align="right"> <a accesskey="n" href="dynamic_memory.html">Next</a></td></tr></table><hr /></div><div class="chapter" title="Chapter 4.  Support"><div class="titlepage"><div><div><h2 class="title"><a id="std.support"></a>Chapter 4
9 Support
10 <a id="id402698" class="indexterm"></a>
11 </h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="support.html#std.support.types">Types</a></span></dt><dd><dl><dt><span class="sect2"><a href="support.html#std.support.types.fundamental">Fundamental Types</a></span></dt><dt><span class="sect2"><a href="support.html#std.support.types.numeric_limits">Numeric Properties</a></span></dt><dt><span class="sect2"><a href="support.html#std.support.types.null">NULL</a></span></dt></dl></dd><dt><span class="sect1"><a href="dynamic_memory.html">Dynamic Memory</a></span></dt><dt><span class="sect1"><a href="termination.html">Termination</a></span></dt><dd><dl><dt><span class="sect2"><a href="termination.html#support.termination.handlers">Termination Handlers</a></span></dt><dt><span class="sect2"><a href="termination.html#support.termination.verbose">Verbose Terminate Handler</a></span></dt></dl></dd></dl></div><p>
12 This part deals with the functions called and objects created
13 automatically during the course of a program's existence.
14 </p><p>
15 While we can't reproduce the contents of the Standard here (you
16 need to get your own copy from your nation's member body; see our
17 homepage for help), we can mention a couple of changes in what
18 kind of support a C++ program gets from the Standard Library.
19 </p><div class="sect1" title="Types"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="std.support.types"></a>Types</h2></div></div></div><div class="sect2" title="Fundamental Types"><div class="titlepage"><div><div><h3 class="title"><a id="std.support.types.fundamental"></a>Fundamental Types</h3></div></div></div><p>
20 C++ has the following builtin types:
21 </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
22 char
23 </p></li><li class="listitem"><p>
24 signed char
25 </p></li><li class="listitem"><p>
26 unsigned char
27 </p></li><li class="listitem"><p>
28 signed short
29 </p></li><li class="listitem"><p>
30 signed int
31 </p></li><li class="listitem"><p>
32 signed long
33 </p></li><li class="listitem"><p>
34 unsigned short
35 </p></li><li class="listitem"><p>
36 unsigned int
37 </p></li><li class="listitem"><p>
38 unsigned long
39 </p></li><li class="listitem"><p>
40 bool
41 </p></li><li class="listitem"><p>
42 wchar_t
43 </p></li><li class="listitem"><p>
44 float
45 </p></li><li class="listitem"><p>
46 double
47 </p></li><li class="listitem"><p>
48 long double
49 </p></li></ul></div><p>
50 These fundamental types are always available, without having to
51 include a header file. These types are exactly the same in
52 either C++ or in C.
53 </p><p>
54 Specializing parts of the library on these types is prohibited:
55 instead, use a POD.
56 </p></div><div class="sect2" title="Numeric Properties"><div class="titlepage"><div><div><h3 class="title"><a id="std.support.types.numeric_limits"></a>Numeric Properties</h3></div></div></div><p>
57 The header <code class="filename">limits</code> defines
58 traits classes to give access to various implementation
59 defined-aspects of the fundamental types. The traits classes --
60 fourteen in total -- are all specializations of the template class
61 <code class="classname">numeric_limits</code>, documented <a class="ulink" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a00593.html" target="_top">here</a>
62 and defined as follows:
63 </p><pre class="programlisting">
64 template&lt;typename T&gt;
65 struct class
67 static const bool is_specialized;
68 static T max() throw();
69 static T min() throw();
71 static const int digits;
72 static const int digits10;
73 static const bool is_signed;
74 static const bool is_integer;
75 static const bool is_exact;
76 static const int radix;
77 static T epsilon() throw();
78 static T round_error() throw();
80 static const int min_exponent;
81 static const int min_exponent10;
82 static const int max_exponent;
83 static const int max_exponent10;
85 static const bool has_infinity;
86 static const bool has_quiet_NaN;
87 static const bool has_signaling_NaN;
88 static const float_denorm_style has_denorm;
89 static const bool has_denorm_loss;
90 static T infinity() throw();
91 static T quiet_NaN() throw();
92 static T denorm_min() throw();
94 static const bool is_iec559;
95 static const bool is_bounded;
96 static const bool is_modulo;
98 static const bool traps;
99 static const bool tinyness_before;
100 static const float_round_style round_style;
102 </pre></div><div class="sect2" title="NULL"><div class="titlepage"><div><div><h3 class="title"><a id="std.support.types.null"></a>NULL</h3></div></div></div><p>
103 The only change that might affect people is the type of
104 <code class="constant">NULL</code>: while it is required to be a macro,
105 the definition of that macro is <span class="emphasis"><em>not</em></span> allowed
106 to be <code class="constant">(void*)0</code>, which is often used in C.
107 </p><p>
108 For <span class="command"><strong>g++</strong></span>, <code class="constant">NULL</code> is
109 <code class="code">#define</code>'d to be
110 <code class="constant">__null</code>, a magic keyword extension of
111 <span class="command"><strong>g++</strong></span>.
112 </p><p>
113 The biggest problem of #defining <code class="constant">NULL</code> to be
114 something like <span class="quote"><span class="quote">0L</span></span> is that the compiler will view
115 that as a long integer before it views it as a pointer, so
116 overloading won't do what you expect. (This is why
117 <span class="command"><strong>g++</strong></span> has a magic extension, so that
118 <code class="constant">NULL</code> is always a pointer.)
119 </p><p>In his book <a class="ulink" href="http://www.awprofessional.com/titles/0-201-92488-9/" target="_top"><span class="emphasis"><em>Effective
120 C++</em></span></a>, Scott Meyers points out that the best way
121 to solve this problem is to not overload on pointer-vs-integer
122 types to begin with. He also offers a way to make your own magic
123 <code class="constant">NULL</code> that will match pointers before it
124 matches integers.
125 </p><p>See
126 <a class="ulink" href="http://www.awprofessional.com/titles/0-201-31015-5/" target="_top">the
127 Effective C++ CD example</a>
128 </p></div></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="bk01pt02.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="bk01pt02.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="dynamic_memory.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Part II. 
129 Standard Contents
130  </td><td width="20%" align="center"><a accesskey="h" href="../spine.html">Home</a></td><td width="40%" align="right" valign="top"> Dynamic Memory</td></tr></table></div></body></html>