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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [libstdc++-v3/] [doc/] [xml/] [manual/] [diagnostics.xml] - Blame information for rev 826

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 424 jeremybenn
2
3
 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"
4
[ ]>
5
 
6
7
8
 
9
10
  
11
    
12
      ISO C++
13
    
14
    
15
      library
16
    
17
  
18
19
 
20
</code></pre></td>
      </tr>
      <tr valign="middle">
         <td>21</td>
         <td></td>
         <td></td>
         <td class="code"><pre><code>  Diagnostics</code></pre></td>
      </tr>
      <tr valign="middle">
         <td>22</td>
         <td></td>
         <td></td>
         <td class="code"><pre><code>  <indexterm><primary>Diagnostics</primary></indexterm></code></pre></td>
      </tr>
      <tr valign="middle">
         <td>23</td>
         <td></td>
         <td></td>
         <td class="code"><pre><code>
24
 
25
26
  
27
  Exceptions
28
 
29
  
30
    API Reference
31
    
32
      All exception objects are defined in one of the standard header
33
      files: exception,
34
      stdexcept, new, and
35
      typeinfo.
36
    
37
 
38
    
39
      The base exception object is exception,
40
      located in exception. This object has no
41
      string member.
42
    
43
 
44
    
45
      Derived from this are several classes that may have a
46
      string member: a full hierarchy can be
47
      found in the source documentation.
48
    
49
 
50
    
51
      Full API details.
52
    
53
 
54
    
55
 
56
  
57
  
58
    Adding Data to <classname>exception</classname>
59
    
60
      The standard exception classes carry with them a single string as
61
      data (usually describing what went wrong or where the 'throw' took
62
    place).  It's good to remember that you can add your own data to
63
    these exceptions when extending the hierarchy:
64
   
65
   
66
   struct My_Exception : public std::runtime_error
67
   {
68
     public:
69
       My_Exception (const string& whatarg)
70
           : std::runtime_error(whatarg), e(errno), id(GetDataBaseID()) { }
71
       int  errno_at_time_of_throw() const { return e; }
72
       DBID id_of_thing_that_threw() const { return id; }
73
     protected:
74
       int    e;
75
       DBID   id;     // some user-defined type
76
   };
77
   
78
 
79
  
80
81
 
82
83
  Concept Checking
84
  
85
    In 1999, SGI added concept checkers to their
86
    implementation of the STL: code which checked the template
87
    parameters of instantiated pieces of the STL, in order to insure
88
    that the parameters being used met the requirements of the
89
    standard.  For example, the Standard requires that types passed as
90
    template parameters to vector be
91
    "Assignable" (which means what you think it means).  The
92
    checking was done during compilation, and none of the code was
93
    executed at runtime.
94
   
95
   
96
     Unfortunately, the size of the compiler files grew significantly
97
     as a result.  The checking code itself was cumbersome.  And bugs
98
     were found in it on more than one occasion.
99
   
100
   
101
     The primary author of the checking code, Jeremy Siek, had already
102
     started work on a replacement implementation.  The new code has been
103
     formally reviewed and accepted into
104
   the
105
   Boost libraries, and we are pleased to incorporate it into the
106
   GNU C++ library.
107
 
108
 
109
   The new version imposes a much smaller space overhead on the generated
110
   object file.  The checks are also cleaner and easier to read and
111
   understand.
112
 
113
 
114
 
115
   They are off by default for all versions of GCC.
116
   They can be enabled at configure time with
117
   --enable-concept-checks.
118
   You can enable them on a per-translation-unit basis with
119
     -D_GLIBCXX_CONCEPT_CHECKS.
120
 
121
 
122
 
123
   Please note that the upcoming C++ standard has first-class
124
   support for template parameter constraints based on concepts in the core
125
   language. This will obviate the need for the library-simulated concept
126
   checking described above.
127
 
128
 
129
130
 
131

powered by: WebSVN 2.1.0

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