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