OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libstdc++-v3/] [doc/] [html/] [manual/] [support.html] - Blame information for rev 742

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 742 jeremybenn
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Chapter 4.  Support</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.76.1"/><meta name="keywords" content="&#10;      ISO C++&#10;    , &#10;      library&#10;    "/><meta name="keywords" content="&#10;      ISO C++&#10;    , &#10;      runtime&#10;    , &#10;      library&#10;    "/><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><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 4. 
4
  Support
5
 
6
</th></tr><tr><td align="left"><a accesskey="p" href="bk01pt02.html">Prev</a> </td><th width="60%" align="center">Part II. 
7
    Standard Contents
8
  </th><td 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"/>Chapter 4. 
9
  Support
10
  <a id="id483878" class="indexterm"/>
11
</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></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>
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="section" title="Types"><div class="titlepage"><div><div><h2 class="title"><a id="std.support.types"/>Types</h2></div></div></div><div class="section" title="Fundamental Types"><div class="titlepage"><div><div><h3 class="title"><a id="std.support.types.fundamental"/>Fundamental Types</h3></div></div></div><p>
20
      C++ has the following builtin types:
21
    </p><div class="itemizedlist"><ul class="itemizedlist"><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="section" title="Numeric Properties"><div class="titlepage"><div><div><h3 class="title"><a id="std.support.types.numeric_limits"/>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="link" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a00593.html">here</a>
62
    and defined as follows:
63
    </p><pre class="programlisting">
64
   template&lt;typename T&gt;
65
     struct class
66
     {
67
       static const bool is_specialized;
68
       static T max() throw();
69
       static T min() throw();
70
 
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();
79
 
80
       static const int min_exponent;
81
       static const int min_exponent10;
82
       static const int max_exponent;
83
       static const int max_exponent10;
84
 
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();
93
 
94
       static const bool is_iec559;
95
       static const bool is_bounded;
96
       static const bool is_modulo;
97
 
98
       static const bool traps;
99
       static const bool tinyness_before;
100
       static const float_round_style round_style;
101
     };
102
   </pre></div><div class="section" title="NULL"><div class="titlepage"><div><div><h3 class="title"><a id="std.support.types.null"/>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="link" href="http://www.awprofessional.com/titles/0-201-92488-9/"><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="link" href="http://www.awprofessional.com/titles/0-201-31015-5/">the
127
      Effective C++ CD example</a>
128
    </p></div></div></div><div class="navfooter"><hr/><table width="100%" summary="Navigation footer"><tr><td align="left"><a accesskey="p" href="bk01pt02.html">Prev</a> </td><td align="center"><a accesskey="u" href="bk01pt02.html">Up</a></td><td align="right"> <a accesskey="n" href="dynamic_memory.html">Next</a></td></tr><tr><td align="left" valign="top">Part II. 
129
    Standard Contents
130
   </td><td align="center"><a accesskey="h" href="../index.html">Home</a></td><td align="right" valign="top"> Dynamic Memory</td></tr></table></div></body></html>

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.