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