OSDN Git Service

* docs/html/configopts.html: Quote StyleSheet attribute values.
[pf3gnuchains/gcc-fork.git] / libstdc++-v3 / docs / html / faq / index.html
1 <html>
2 <head>
3    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
4    <meta name="KEYWORDS" content="libstdc++, libstdc++-v3, GCC, g++, libg++, STL">
5    <meta name="DESCRIPTION" content="FAQ for the GNU libstdc++ effort.">
6    <title>libstdc++-v3 FAQ</title>
7 <link rel="StyleSheet" href="../lib3styles.css">
8 <!-- 
9   ** Locations of "the most recent snapshot is the Nth" text are 
10   ** answers 1_1, 1_4, 4_1, 5_6.
11 -->
12 </head>
13 <body>
14
15 <h1 class="centered">libstdc++ Frequently Asked Questions</h1>
16
17 <p>The latest version of this document is always available at
18 <a href="http://gcc.gnu.org/onlinedocs/libstdc++/faq/">
19 http://gcc.gnu.org/onlinedocs/libstdc++/faq/</a>.</p>
20
21 <p>To the <a href="http://gcc.gnu.org/libstdc++/">libstdc++-v3 homepage</a>.
22
23 <!-- ####################################################### -->
24 <hr>
25 <h1>Questions</h1>
26 <ol>
27    <li><a href="#1_0">General Information</a>
28    <!-- I suspect these will mostly be links to/into existing documents. -->
29    <ol>
30       <li><a href="#1_1">What is libstdc++-v3?</a>
31       <li><a href="#1_2">Why should I use libstdc++?</a>
32       <li><a href="#1_3">Who's in charge of it?</a>
33       <li><a href="#1_4">How do I get libstdc++?</a>
34       <li><a href="#1_5">When is libstdc++ going to be finished?</a>
35       <li><a href="#1_6">How do I contribute to the effort?</a>
36       <li><a href="#1_7">What happened to libg++?  I need that!</a>
37       <li><a href="#1_8">What if I have more questions?</a>
38       <li><a href="#1_9">What are the license terms for libstdc++-v3?</a>
39    </ol>
40
41    <li><a href="#2_0">Installation</a>
42       <ol>
43          <li><a href="#2_1">How do I install libstdc++-v3?</a>
44          <li><a href="#2_2">[removed]</a>
45          <li><a href="#2_3">What is this CVS thing that you keep 
46                             mentioning?</a>
47          <li><a href="#2_4">How do I know if it works?</a>
48       </ol>
49
50    <li><a href="#3_0">Platform-Specific Issues</a>
51       <ol>
52          <li><a href="#3_1">Can libstdc++-v3 be used with &lt;my
53                             favorite compiler&gt;?</a>
54          <li><a href="#3_2">[removed]</a>
55          <li><a href="#3_3">Building under DEC OSF kills the assembler</a>
56       </ol>
57
58    <li><a href="#4_0">Known Bugs and Non-Bugs</a>
59       <ol>
60          <li><a href="#4_1">What works already?</a>
61          <li><a href="#4_2">Bugs in gcc/g++ (not libstdc++-v3)</a>
62          <li><a href="#4_3">Bugs in the C++ language/lib specification</a>
63          <li><a href="#4_4">Things in libstdc++ that look like bugs</a>
64            <ul>
65              <li><a href="#4_4_iostreamclear">reopening a stream fails</a>
66              <li><a href="#4_4_Weff">-Weffc++ complains too much</a>
67              <li><a href="#4_4_rel_ops">&quot;ambiguous overloads&quot;
68                                  after including an old-style header</a>
69              <li><a href="#4_4_interface">The g++-3 headers are
70                                  <strong>not ours</strong></a>
71              <li><a href="#4_4_glibc">compilation errors from streambuf.h</a>
72              <li><a href="#4_4_checks">errors about <em>*Cconcept</em> and
73                                  <em>constraints</em> in the STL...</a>
74            </ul>
75          <li><a href="#4_5">Aw, that's easy to fix!</a>
76       </ol>
77
78    <li><a href="#5_0">Miscellaneous</a>
79       <ol>
80          <li><a href="#5_1">string::iterator is not char*;
81                             vector&lt;T&gt;::iterator is not T*</a>
82          <li><a href="#5_2">What's next after libstdc++-v3?</a>
83          <li><a href="#5_3">What about the STL from SGI?</a>
84          <li><a href="#5_4">Extensions and Backward Compatibility</a>
85          <li><a href="#5_5">[removed]</a>
86          <li><a href="#5_6">Is libstdc++-v3 thread-safe?</a>
87          <li><a href="#5_7">How do I get a copy of the ISO C++ Standard?</a>
88       </ol>
89
90 </ol>
91
92 <hr>
93
94 <!-- ####################################################### -->
95
96 <h1><a name="1_0">1.0 General Information</a></h1>
97 <!-- I suspect these will mostly be links to/into existing documents. -->
98    <h2><a name="1_1">1.1 What is libstdc++-v3?</a></h2>
99       <p>The GNU Standard C++ Library v3, or libstdc++-2.9x, is an 
100          ongoing project to implement the ISO 14882 Standard C++ library 
101          as described in chapters 17 through 27 and annex D.  As the 
102          library reaches stable plateaus, it is captured in a snapshot
103          and released.  The current release is
104          <a href="http://gcc.gnu.org/libstdc++/download.html">the
105          eleventh snapshot</a>.  For those who want to see exactly how
106          far the project has come, or just want the latest
107          bleeding-edge code, the up-to-date source is available over
108          anonymous CVS, and can even be browsed over the Web (see below). 
109       </p> 
110       <p>A more formal description of the V3 goals can be found in the
111          official <a href="../17_intro/DESIGN">design document</a>. 
112       </p> 
113
114 <hr>
115    <h2><a name="1_2">1.2 Why should I use libstdc++?</a></h2>
116       <p>The completion of the ISO C++ standardization gave the
117          C++ community a powerful set of reuseable tools in the form
118          of the C++ Standard Library.  However, all existing C++
119          implementations are (as the Draft Standard used to say)
120          &quot;incomplet and incorrekt,&quot; and many suffer from
121          limitations of the compilers that use them.
122       </p> 
123       <p>The GNU C/C++/FORTRAN/&lt;pick-a-language&gt; compiler
124          (<code>gcc</code>, <code>g++</code>, etc) is widely considered to be
125          one of the leading compilers in the world.  Its development
126          has recently been taken over by the 
127          <a href="http://gcc.gnu.org/">GCC team</a>.  All of
128          the rapid development and near-legendary
129          <a href="http://gcc.gnu.org/gcc-2.95/buildstat.html">portability</a>
130          that are the hallmarks of an open-source project are being
131          applied to libstdc++.
132       </p>
133       <p>That means that all of the Standard classes and functions
134          (such as <code>string</code>, <code>vector&lt;&gt;</code>, iostreams,
135          and algorithms) will be freely available and fully compliant.
136          Programmers will no longer need to &quot;roll their own&quot;
137          nor be worried about platform-specific incompatabilities.
138       </p>
139
140 <hr>
141    <h2><a name="1_3">1.3 Who's in charge of it?</a></h2>
142       <p>The libstdc++ project is contributed to by several developers
143          all over the world, in the same way as GCC or Linux.
144          Benjamin Kosnik, Gabriel Dos Reis, Phil Edwards, and Ulrich
145          Drepper are the lead maintainers of the CVS archive.
146       </p>
147       <p>Development and discussion is held on the libstdc++ mailing
148          list.  Subscribing to the list, or searching the list
149          archives, is open to everyone.  You can read instructions for
150          doing so on the <a href="http://gcc.gnu.org/libstdc++/">homepage</a>.
151          If you have questions, ideas, code, or are just curious, sign up!
152       </p>
153
154 <hr>
155    <h2><a name="1_4">1.4 How do I get libstdc++?</a></h2>
156       <p>The eleventh (and latest) snapshot of libstdc++-v3 is
157          <a href="http://gcc.gnu.org/libstdc++/download.html">available via
158          ftp</a>.  The filename is libstdc++-2.92.tar.gz.
159       </p>
160       <p>The <a href="http://gcc.gnu.org/libstdc++/">homepage</a>
161          has instructions for retrieving the latest CVS sources, and for
162          browsing the CVS sources over the web.
163       </p>
164       <p>The subset commonly known as the Standard Template Library
165          (chapters 23 through 25, mostly) is adapted from the final release
166          of the SGI STL.
167       </p> 
168
169 <hr>
170    <h2><a name="1_5">1.5 When is libstdc++ going to be finished?</a></h2>
171 <!--      <p>Nathan Myers gave the best of all possible answers in <A 
172          href="http://www.deja.com/getdoc.xp?AN=469581698&fmt=text">a 
173          Usenet article</a>.</p>
174 which is no longer available, thanks deja...-->
175       <p>Nathan Myers gave the best of all possible answers, responding to a
176          Usenet article asking this question:  <em>Sooner, if you help.</em>
177       </p>
178
179 <hr>
180    <h2><a name="1_6">1.6 How do I contribute to the effort?</a></h2>
181       <p>Here is <a href="../17_intro/contribute.html">a
182          page devoted to this topic</a>.  Subscribing to the mailing
183          list (see above, or the homepage) is a very good idea if you
184          have something to contribute, or if you have spare time and
185          want to help.  Contributions don't have to be in the form of
186          source code; anybody who is willing to help write
187          documentation, for example, or has found a bug in code that
188          we all thought was working, is more than welcome!
189       </p> 
190
191 <hr>
192    <h2><a name="1_7">1.7 What happened to libg++?  I need that!</a></h2>
193       <p>The most recent libg++ README states that libg++ is no longer
194          being actively maintained.  It should not be used for new
195          projects, and is only being kicked along to support older code.
196       </p>
197       <p>The libg++ was designed and created when there was no Standard
198          to provide guidance.  Classes like linked lists are now provided
199          for by <code>list&lt;T&gt;</code> and do not need to be created by
200          <code>genclass</code>.  (For that matter, templates exist now and
201          are well-supported, whereas genclass (mostly) predates them.)
202       </p>
203       <p>There are other classes in libg++ that are not specified in the
204          ISO Standard (e.g., statistical analysis).  While there are a
205          lot of really useful things that are used by a lot of people
206          (e.g., statistics :-), the Standards Committee couldn't include
207          everything, and so a lot of those &quot;obvious&quot; classes
208          didn't get included.
209       </p>
210       <p>Since libstdc++ is an implementation of the Standard Library, we
211          have no plans at this time to include non-Standard utilities
212          in the implementation, however handy they are.  (The extensions
213          provided in the SGI STL aren't maintained by us and don't get
214          a lot of our attention, because they don't require a lot of our
215          time.)  It is entirely plausable that the &quot;useful stuff&quot;
216          from libg++ might be extracted into an updated utilities library,
217          but nobody has stated such a project yet.
218       </p>
219       <!-- The advertisement, so to speak, might have to go.  Hmmmmm.  -->
220       <p>(The <a href="http://www.boost.org/">Boost</a> site houses free
221          C++ libraries that do varying things, and happened to be started
222          by members of the Standards Committee.  Certain &quot;useful
223          stuff&quot; classes will probably migrate there.)
224       </p>
225       <p>For the bold and/or desperate, the
226          <a href="http://gcc.gnu.org/fom_serv/cache/33.html">GCC FAQ</a>
227          describes where to find the last libg++ source.
228       </p>
229
230 <hr>
231    <h2><a name="1_8">1.8 What if I have more questions?</a></h2>
232       <p>If you have read the README and RELEASE-NOTES files, and your
233          question remains unanswered, then just ask the mailing list.
234          At present, you do not need to be subscribed to the list to
235          send a message to it.  More information is available on the
236          homepage (including how to browse the list archives); to send
237          to the list, use <a href="mailto:libstdc++@gcc.gnu.org">
238          <code>libstdc++@gcc.gnu.org</code></a>.
239       </p>
240       <p>If you have a question that you think should be included here,
241          or if you have a question <em>about</em> a question/answer here,
242          contact <a href="mailto:pme@gcc.gnu.org">Phil Edwards</a>
243          or <a href="mailto:gdr@gcc.gnu.org">Gabriel Dos Reis</a>.
244       </p>
245
246 <hr>
247    <h2><a name="1_9">1.9 What are the license terms for libstdc++-v3?</a></h2>
248       <p>See <a href="../17_intro/license.html">our license description</a>
249          for these and related questions.
250       </p>
251
252 <hr>
253 <h1><a name="2_0">2.0 Installation</a></h1>
254    <h2><a name="2_1">2.1 How do I install libstdc++-v3?</a></h2>
255       <p>Complete instructions are not given here (this is a FAQ, not
256          an installation document), but the tools required are few:
257       </p>
258          <ul>
259             <li> A 3.x release of GCC.  Note that building GCC is much
260                  easier and more automated than building the GCC 2.[78]
261                  series was.  If you are using GCC 2.95, you can still
262                  build earlier snapshots of libstdc++.
263             <li> GNU Make is recommended, but should not be required.
264             <li> The GNU Autotools are needed if you are messing with
265                  the configury or makefiles.
266          </ul>
267       <p>The file <a href="../documentation.html">documentation.html</a>
268          provides a good overview of the steps necessary to build, install,
269          and use the library.  Instructions for configuring the library
270          with new flags such as --enable-threads are there also, as well as
271          patches and instructions for working with GCC 2.95.
272       </p>
273       <p>The top-level install.html and
274          <a href="../17_intro/RELEASE-NOTES">RELEASE-NOTES</a> files contain
275          the exact build and installation instructions.  You may wish to
276          browse those files over CVSweb ahead of time to get a feel for
277          what's required.  RELEASE-NOTES is located in the
278          &quot;.../docs/17_intro/&quot; directory of the distribution.
279       </p> 
280
281 <hr>
282    <h2><a name="2_2">2.2 [removed]</a></h2>
283       <p>This question has become moot and has been removed.  The stub
284          is here to preserve numbering (and hence links/bookmarks).
285       </p>
286
287 <hr>
288    <h2><a name="2_3">2.3 What is this CVS thing that you
289                          keep mentioning?</a></h2>
290       <p>The <em>Concurrent Versions System</em> is one of several revision
291          control packages.  It was selected for GNU projects because it's
292          free (speech), free (beer), and very high quality.  The <A
293          href="http://www.gnu.org/software/cvs/cvs.html">CVS entry in
294          the GNU software catalogue</a> has a better description as 
295          well as a
296          <a href="http://www.cvshome.org/">link to the makers of CVS</a>. 
297       </p>
298       <p>The &quot;anonymous client checkout&quot; feature of CVS is
299          similar to anonymous FTP in that it allows anyone to retrieve
300          the latest libstdc++ sources.
301       </p>
302       <p>After the first of April, American users will have a
303          &quot;/pharmacy&quot; command-line option...
304          <!-- wonder how long that'll live -->
305       </p>
306
307 <hr>
308    <h2><a name="2_4">2.4 How do I know if it works?</a></h2>
309       <p>libstdc++-v3 comes with its own testsuite.  You do not need
310          to actually install the library (&quot;<code>make
311          install</code>&quot;) to run the testsuite.
312       </p>
313       <p>To run the testsuite on the library after building it, use
314          &quot;make check&quot; while in your build directory.  To run
315          the testsuite on the library after building and installing it,
316          use &quot;make check-install&quot; instead.
317       </p>
318       <p>If you find bugs in the testsuite programs themselves, or if you
319          think of a new test program that should be added to the suite,
320          <strong>please</strong> write up your idea and send it to the list!
321       </p>
322
323 <hr>
324 <h1><a name="3_0">3.0 Platform-Specific Issues</a></h1>
325    <h2><a name="3_1">3.1 Can libstdc++-v3 be used with &lt;my
326                          favorite compiler&gt;?</a></h2>
327       <p>Probably not.  Yet.</p>
328       <p>Because GCC advances so rapidly, development and testing of
329          libstdc++ is being done almost entirely under that compiler.
330          If you are curious about whether other, lesser compilers
331          (*grin*) support libstdc++, you are more than welcome to try.
332          Configuring and building the library (see above) will still
333          require certain tools, however.  Also keep in mind that
334          <em>building</em> libstdc++ does not imply that your compiler
335          will be able to <em>use</em> all of the features found in the
336          C++ Standard Library.
337       </p>
338       <p>Since the goal of ISO Standardization is for all C++
339          implementations to be able to share code, the final libstdc++
340          should, in theory, be useable under any ISO-compliant
341          compiler.  It will still be targeted and optimized for
342          GCC/g++, however.
343       </p> 
344
345 <hr>
346    <h2><a name="3_2">3.2 [removed]</a></h2>
347       <p>This question has become moot and has been removed.  The stub
348          is here to preserve numbering (and hence links/bookmarks).
349       </p>
350
351 <hr>
352    <h2><a name="3_3">3.3 Building DEC OSF kills the assembler</a></h2>
353       <p>The <code>atomicity.h</code> header for the Alpha processor
354          currently uses pseudo-operators which the DEC assembler
355          doesn't understand (in particular, .subsection and .previous).
356          The simple solution is to install GNU <code>as</code> and arrange
357          for the GCC build to use it (or merge the sources and build
358          it during the bootstrap).
359       </p>
360       <p>Anyone who
361          <a href="http://gcc.gnu.org/ml/libstdc++/2000-12/msg00279.html">knows
362          the DEC assembler well enough</a> to provide the equivalent of
363          these two pseudos would win praise and accolades from many.
364       </p>
365
366 <hr>
367 <h1><a name="4_0">4.0 Known Bugs and Non-Bugs</a></h1>
368    <em>Note that this section can get rapdily outdated -- such is the
369    nature of an open-source project.  For the latest information, join
370    the mailing list or look through recent archives.   The RELEASE-
371    NOTES and BUGS files are generally kept up-to-date.</em> 
372
373    <p>For 3.0.1, the most common &quot;bug&quot; is an apparently missing
374       &quot;<code>../</code>&quot; in include/Makefile, resulting in files
375       like gthr.h and gthr-single.h not being found.
376    </p>
377    <p>Please read
378       <a href="http://gcc.gnu.org/install/configure.html">the configuration
379       instructions for GCC</a>,
380       specifically the part about configuring in a separate build directory,
381       and how strongly recommended it is.  Building in the source directory
382       is fragile, is rarely tested, and tends to break, as in this case.
383       Work has already gone into the source tree to make this less painful
384       for the next release.
385    </p>
386    <p><strong>Please do not report this as a bug.  We know about it.</strong>
387       Reporting this -- or any other problem that's already been fixed --
388       hinders the development of GCC, because we have to take time to
389       respond to your report.  Thank you.
390    </p>
391
392    <h2><a name="4_1">4.1 What works already?</a></h2>
393       <p>This is a verbatim clip from the &quot;Status&quot; section
394           of the RELEASE-NOTES for the latest snapshot.
395       </p> 
396
397 <!-- Yeah, I meant that "verbatim clip" thing literally... :-)  -->
398
399 <pre>
400 New:
401 ---
402 - preliminary doxygen documentation has been added. Running &quot;make
403   doxygen&quot; in the libstdc++-v3 build directory will generate HTML
404   documentation that can be used to cross-reference names and files in
405   the library.
406 - a dejagnu based testing framework has been added
407 - a new implementation of the concept checking code has been ported
408   from the boost libraries.
409 - support for -fno-exceptions has been added
410 - stdexcept was re-written
411 - using deprecated or antiquated headers now gives a warning
412 - the stdio interface to iostreams has been tweaked, and now works
413   with synchronized c/c++ io
414 - new libsupc++ routines implementing the IA-64 C++ ABI.
415 - HPUX configuration files
416 - support for AIX added
417 - a lot of bugs were fixed.
418 - preliminary named locales implemented
419 - portability improvements made to generation of &lt;limits&gt;
420 - speedups to improve configuration time.
421 - DJGPP support added.
422 - support for dlopening shared libstdc++
423 </pre>
424
425
426 <hr>
427    <h2><a name="4_2">4.2 Bugs in gcc/g++ (not libstdc++-v3)</a></h2>
428       <p>This is by no means meant to be complete nor exhaustive, but
429          mentions some problems that users may encounter when building
430          or using libstdc++.  If you are experiencing one of these
431          problems, you can find more information on the libstdc++ and
432          the GCC mailing lists.
433       </p>
434       <ul>
435          <li>As of 2.91, these bugs have all been fixed.  We look forward
436              to new ones, well, not exactly...
437       </ul>
438
439 <hr>
440    <h2><a name="4_3">4.3 Bugs in the C++ language/lib specification</a></h2>
441       <p>Yes, unfortunately, there are some.  In a
442          <a href="http://gcc.gnu.org/ml/libstdc++/1998/msg00006.html">message
443          to the list</a>, Nathan Myers announced that he has started a list of
444          problems in the ISO C++ Standard itself, especially with
445          regard to the chapters that concern the library.  The list
446          itself is
447          <a href="http://www.cantrip.org/draft-bugs.txt">posted on his
448          website</a>.  Developers who are having problems interpreting
449          the Standard may wish to consult his notes.
450       </p>
451       <p>For those people who are not part of the ISO Library Group
452          (i.e., nearly all of us needing to read this page in the first
453          place :-), a public list of the library defects is occasionally
454          published <a href="http://anubis.dkuug.dk/jtc1/sc22/wg21/">here</a>.
455          Some of these have resulted in <a href="#5_2">code changes</a>.
456       </p>
457
458 <hr>
459    <h2><a name="4_4">4.4 Things in libstdc++ that look like bugs</a></h2>
460       <p>There are things which are not bugs in the compiler (4.2) nor
461          the language specification (4.3), but aren't really bugs in
462          libstdc++, either.  Really!  Please do not report these as bugs.
463       </p>
464       <a name="4_4_Weff">
465         <p><strong>-Weffc++</strong>
466            The biggest of these is the quadzillions of warnings about the
467            library headers emitted when <code>-Weffc++</code> is used.  Making
468            libstdc++ &quot;-Weffc++-clean&quot; is not a goal of the project,
469            for a few reasons.  Mainly, that option tries to enforce
470            object-oriented programming, while the Standard Library isn't
471            necessarily trying to be OO.  There are multiple solutions
472            under discussion.
473         </p>
474       </a>
475       <a name="4_4_iostreamclear">
476         <p><strong>reopening a stream fails</strong>
477            Did I just say that -Weffc++ was our biggest false-bug report?  I
478            lied.  (It used to be.)  Today it seems to be reports that after
479            executing a sequence like
480            <pre>
481     #include &lt;fstream&gt;
482     ...
483     std::fstream  fs(&quot;a_file&quot;);
484     // .
485     // . do things with fs...
486     // .
487     fs.close();
488     fs.open(&quot;a_new_file&quot;);</pre>
489            all operations on the re-opened <code>fs</code> will fail, or at
490            least act very strangely.  Yes, they often will, especially if
491            <code>fs</code> reached the EOF state on the previous file.  The
492            reason is that the state flags are <strong>not</strong> cleared
493            on a successful call to open().  The standard unfortunately did
494            not specify behavior in this case, and to everybody's great sorrow,
495            the <a href="../ext/howto.html#5">proposed LWG resolution</a> (see
496            DR #22) is to leave the flags unchanged.  You must insert a call
497            to <code>fs.clear()</code> between the calls to close() and open(),
498            and then everything will work like we all expect it to work.
499         </p>
500       </a>
501       <a name="4_4_rel_ops">
502         <p><strong>rel_ops</strong>
503            Another is the <code>rel_ops</code> namespace and the template
504            comparison operator functions contained therein.  If they become
505            visible in the same namespace as other comparison functions
506            (e.g., '<code>using</code>' them and the &lt;iterator&gt; header),
507            then you will suddenly be faced with huge numbers of ambiguity
508            errors.  This was discussed on the -v3 list; Nathan Myers
509            <a href="http://gcc.gnu.org/ml/libstdc++/2001-01/msg00247.html">sums
510            things up here</a>.
511         </p>
512       </a>
513       <a name="4_4_interface"><h3>The g++-3 headers are
514                                       <em>not ours</em></h3>
515         <p>If you have found an extremely broken header file which is
516            causing problems for you, look carefully before submitting a
517            &quot;high&quot; priority bug report (which you probably shouldn't
518            do anyhow; see the last paragraph of the page describing
519          <a href="http://gcc.gnu.org/gnatswrite.html">the GCC bug database</a>).
520         </p>
521         <p>If the headers are in <CODE>${prefix}/include/g++-3</CODE>, then
522            you are using the old libstdc++-v2 library, which is nonstandard
523            and unmaintained.  Do not report problems with -v2 to the -v3
524            mailing list.
525         </p>
526         <p>Currently our header files are installed in
527            <code>${prefix}/include/g++-v3</code> (see the 'v'?).  This may
528            change with the next release of GCC, as it may be too confusing,
529            but <a href="http://gcc.gnu.org/ml/gcc/2000-10/msg00732.html">the
530            question has not yet been decided</a>.
531         </p>
532       </a>
533       <a name="4_4_glibc">
534         <p><strong>glibc</strong>
535            If you're on a GNU/Linux system and have just upgraded to
536            glibc 2.2, but are still using gcc 2.95.2, then you should have
537            read the glibc FAQ, specifically 2.34:
538    <pre>
539 2.34.   When compiling C++ programs, I get a compilation error in streambuf.h.
540
541 {BH} You are using g++ 2.95.2? After upgrading to glibc 2.2, you need to
542 apply a patch to the include files in /usr/include/g++, because the fpos_t
543 type has changed in glibc 2.2.  The patch is at
544 http://clisp.cons.org/~haible/gccinclude-glibc-2.2-compat.diff
545    </pre>
546            Note that 2.95.x shipped with the
547            <a href="#4_4_interface">old v2 library</a> which is no longer
548            maintained.  Also note that gcc 2.95.3 fixes this problem, but
549            requires a separate patch for libstdc++-v3.
550         </p>
551       </a>
552       <a name="4_4_checks">
553         <p><strong>concept checks</strong>
554            If you see compilation errors containing messages about
555            <code> <em>foo</em>Concept </code>and a<code> constraints </code>
556            member function, then most likely you have violated one of the
557            requirements for types used during instantiation of template
558            containers and functions.  For example, EqualityComparableConcept
559            appears if your types must be comparable with == and you have not
560            provided this capability (a typo, or wrong visibility, or you
561            just plain forgot, etc).
562         </p>
563         <p>More information, including how to optionally enable/disable the
564            checks, is available
565            <a href="../19_diagnostics/howto.html#3">here</a>.
566         </p>
567       </a>
568
569 <hr>
570    <h2><a name="4_5">4.5 Aw, that's easy to fix!</a></h2>
571       <p>If you have found a bug in the library and you think you have
572          a working fix, then send it in!  The main GCC site has a page
573          on <a href="http://gcc.gnu.org/contribute.html">submitting
574          patches</a> that covers the procedure, but for libstdc++ you
575          should also send the patch to our mailing list in addition to
576          the GCC patches mailing list.  The libstdc++
577          <a href="../17_intro/contribute.html">contributors' page</a>
578          also talks about how to submit patches.
579       </p>
580       <p>In addition to the description, the patch, and the ChangeLog
581          entry, it is a Good Thing if you can additionally create a small
582          test program to test for the presence of the bug that your
583          patch fixes.  Bugs have a way of being reintroduced; if an old
584          bug creeps back in, it will be caught immediately by the 
585          <a href="#2_4">testsuite</a> -- but only if such a test exists.
586       </p>
587
588 <hr>
589 <h1><a name="5_0">5.0 Miscellaneous</a></h1>
590    <h2><a name="5_1">5.1 string::iterator is not char*;
591                      vector&lt;T&gt;::iterator is not T*</a></h2>
592       <p>If you have code that depends on container&lt;T&gt; iterators
593          being implemented as pointer-to-T, your code is broken.
594       </p>
595       <p>While there are arguments for iterators to be implemented in
596          that manner, A) they aren't very good ones in the long term,
597          and B) they were never guaranteed by the Standard anyway.  The
598          type-safety achieved by making iterators a real class rather
599          than a typedef for <code>T*</code> outweighs nearly all opposing
600          arguments.
601       </p>
602       <p>Code which does assume that a vector iterator <code> i </code>
603          is a pointer can often be fixed by changing <code> i </code> in
604          certain expressions to <code> &amp;*i </code>.  Future revisions
605          of the Standard are expected to bless this usage for
606          vector&lt;&gt; (but not for basic_string&lt;&gt;).
607       </p>
608
609 <hr>
610    <h2><a name="5_2">5.2 What's next after libstdc++-v3?</a></h2>
611       <p>Hopefully, not much.  The goal of libstdc++-v3 is to produce
612          a fully-compliant, fully-portable Standard Library.  After that,
613          we're mostly done:  there won't <em>be</em> any more compliance
614          work to do.  However:
615       </p>
616       <ol>
617       <li><p>The ISO Committee will meet periodically to review Defect Reports
618          in the C++ Standard.  Undoubtedly some of these will result in
619          changes to the Standard, which will be reflected in patches to
620          libstdc++.  Some of that is already happening, see 4.2.  Some of
621          those changes are being predicted by the library maintainers, and
622          we add code to the library based on what the current proposed
623          resolution specifies.  Those additions are listed in
624          <a href="../ext/howto.html#5">the extensions page</a>.
625       </p>
626       <li><p>Performance tuning.  Lots of performance tuning.  This too is
627          already underway for post-3.0 releases, starting with memory
628          expansion in container classes and buffer usage in synchronized
629          stream objects.
630       </p>
631       <li><p>An ABI for libstdc++ will eventually be developed, so that
632          multiple binary-incompatible copies of the library can be replaced
633          with a single backwards-compatible library, like libgcc_s.so is.
634       </p>
635       <li><p>The current libstdc++ contains extensions to the Library which
636          must be explicitly requested by client code (for example, the
637          hash tables from SGI).  Other extensions may be added to
638          libstdc++-v3 if they seem to be &quot;standard&quot; enough.
639          (For example, the &quot;long long&quot; type from C99.)
640          Bugfixes and rewrites (to improve or fix thread safety, for
641          instance) will of course be a continuing task.
642       </p>
643       </ol>
644       <p><a href="http://gcc.gnu.org/ml/libstdc++/1999/msg00080.html">This
645          question</a> about the next libstdc++ prompted some brief but
646          interesting
647          <a href="http://gcc.gnu.org/ml/libstdc++/1999/msg00084.html">speculation</a>.
648       </p>
649
650 <hr>
651    <h2><a name="5_3">5.3 What about the STL from SGI?</a></h2>
652       <p>The <a href="http://www.sgi.com/Technology/STL/">STL from SGI</a>,
653          version 3.3, was the most recent merge of the STL codebase.  The
654          code in libstdc++ contains many fixes and changes, and it is
655          very likely that the SGI code is no longer under active
656          development.  We expect that no future merges will take place.
657       </p>
658       <p>In particular, <code>string</code> is not from SGI and makes no
659          use of their &quot;rope&quot; class (which is included as an
660          optional extension), nor is <code>valarray</code> and some others.
661          Classes like <code>vector&lt;&gt;</code> are, however.
662       </p>
663       <p>The FAQ for SGI's STL (one jump off of their main page) is
664          recommended reading.
665       </p>
666
667 <hr>
668    <h2><a name="5_4">5.4 Extensions and Backward Compatibility</a></h2>
669       <p>Although you can specify <code>-I</code> options to make the
670          preprocessor search the g++-v3/ext and /backward directories,
671          it is better to refer to files there by their path, as in:
672          <!-- Careful, the leading spaces in PRE show up directly. -->
673       </p>
674          <pre>
675        #include &lt;ext/hash_map&gt;
676          </pre>
677       <p>Extensions to the library have
678          <a href="../ext/howto.html">their own page</a>.
679       </p>
680
681 <hr>
682    <h2><a name="5_5">5.5 [removed]</a></h2>
683       <p>This question has become moot and has been removed.  The stub
684          is here to preserve numbering (and hence links/bookmarks).
685       </p>
686
687 <hr>
688    <h2><a name="5_6">5.6 Is libstdc++-v3 thread-safe?</a></h2>
689       <p>When the system's libc is itself thread-safe, libstdc++-v3
690          strives to be thread-safe.  The user-code must guard against
691          concurrent method calls which may access any particular
692          library object's state.  Typically, the application
693          programmer may infer what object locks must be held based on
694          the objects referenced in a method call.  Without getting
695          into great detail, here is an example which requires
696          user-level locks:
697       </p>
698          <pre>
699        library_class_a shared_object_a;
700
701        thread_main () {
702          library_class_b *object_b = new library_class_b;
703          shared_object_a.add_b (object_b); // must hold lock for shared_object_a
704          shared_object_a.mutate (); // must hold lock for shared_object_a
705        }
706
707        // Multiple copies of thread_main() are started in independent threads.
708          </pre>
709       <p>Under the assumption that object_a and object_b are never
710          exposed to another thread, here is an example that should not
711          require any user-level locks:
712       </p>
713          <pre>
714        thread_main () {
715          library_class_a object_a;
716          library_class_b *object_b = new library_class_b;
717          object_a.add_b (object_b);
718          object_a.mutate ();
719        }
720          </pre>
721       <p>However, as of gcc 3.0 and point releases, beware that there
722          may be cases where shared nested or global objects (neither
723          of which are visible to user-code) are affected or used
724          without any internal locking.
725          <!-- Is this warning still required? - Loren -->
726       </p>
727       <p>In some cases, a stronger thread-safe claim is made.  The
728          string class is thread-safe without user-code guards (i.e. a
729          string object may be shared and accessed between threads
730          without user-level locking).  The IO classes are thread-safe
731          with user-code guards whenever the same user-visible object
732          may be accessed by multiple threads.  The container classes
733          are thread-safe with user-code guards whenever the same
734          container may be accessed by multiple threads.  All accesses
735          to hidden shared objects (e.g. the global allocator objects)
736          are believed to be properly guarded within the library.
737       </p>
738       <p>See chapters <a href="../17_intro/howto.html#3">17</a>,
739          <a href="../23_containers/howto.html#3">23</a> and
740          <a href="../27_io/howto.html#9">27</a> for more information.
741       </p>
742
743 <hr>
744    <h2><a name="5_7">5.7 How do I get a copy of the ISO C++ Standard?</a></h2>
745       <p>Copies of the full ISO 14882 standard are available on line via the
746          ISO mirror site for committee members.  Non-members, or those who
747          have not paid for the privilege of sitting on the committee and
748          sustained their two-meeting commitment for voting rights, may get a
749          copy of the standard from their respective national standards
750          organization.  In the USA, this national standards organization is
751          ANSI and their website is right <a href="http://www.ansi.org">here</a>.
752          (And if you've already registered with them, clicking this link will
753          take you to directly to the place where you can
754 <a href="http://webstore.ansi.org/ansidocstore/product.asp?sku=ISO%2FIEC+14882%2D1998">buy
755          the standard on-line</a>.
756       </p>
757       <p>Who is your country's member body?  Visit the
758          <a href="http://www.iso.ch/">ISO homepage</a> and find out!
759       </p>
760
761 <!-- ####################################################### -->
762
763 <hr>
764 <p class="fineprint"><em>
765 See <a href="../17_intro/license.html">license.html</a> for copying conditions.
766 Comments and suggestions are welcome, and may be sent to
767 <a href="mailto:libstdc++@gcc.gnu.org">the libstdc++ mailing list</a>.
768 </em></p>
769
770
771 </body>
772 </html>
773