2 libstdc++ Frequently Asked Questions
4 The latest version of this document is always available at
5 [1]http://gcc.gnu.org/onlinedocs/libstdc++/faq/. The main
6 documentation page is at
7 [2]http://gcc.gnu.org/onlinedocs/libstdc++/documentation.html.
9 To the [3]libstdc++-v3 homepage.
10 _________________________________________________________________
14 1. [4]General Information
15 1. [5]What is libstdc++-v3?
16 2. [6]Why should I use libstdc++?
17 3. [7]Who's in charge of it?
18 4. [8]How do I get libstdc++?
19 5. [9]When is libstdc++ going to be finished?
20 6. [10]How do I contribute to the effort?
21 7. [11]What happened to libg++? I need that!
22 8. [12]What if I have more questions?
23 9. [13]What are the license terms for libstdc++-v3?
25 1. [15]How do I install libstdc++-v3?
27 3. [17]What is this CVS thing that you keep mentioning?
28 4. [18]How do I know if it works?
29 5. [19]This library is HUGE! And what's libsupc++?
30 3. [20]Platform-Specific Issues
31 1. [21]Can libstdc++-v3 be used with <my favorite compiler>?
33 3. [23]Building under DEC OSF kills the assembler
34 4. [24]I can't use 'long long' on Solaris
35 4. [25]Known Bugs and Non-Bugs
36 1. [26]What works already?
37 2. [27]Bugs in gcc/g++ (not libstdc++-v3)
38 3. [28]Bugs in the C++ language/lib specification
39 4. [29]Things in libstdc++ that look like bugs
40 o [30]reopening a stream fails
41 o [31]-Weffc++ complains too much
42 o [32]"ambiguous overloads" after including an old-style
44 o [33]The g++-3 headers are not ours
45 o [34]compilation errors from streambuf.h
46 o [35]errors about *Cconcept and constraints in the STL...
47 5. [36]Aw, that's easy to fix!
49 1. [38]string::iterator is not char*; vector<T>::iterator is not
51 2. [39]What's next after libstdc++-v3?
52 3. [40]What about the STL from SGI?
53 4. [41]Extensions and Backward Compatibility
55 6. [43]Is libstdc++-v3 thread-safe?
56 7. [44]How do I get a copy of the ISO C++ Standard?
57 8. [45]What's an ABI and why is it so messy?
58 _________________________________________________________________
60 1.0 General Information
62 1.1 What is libstdc++-v3?
64 The GNU Standard C++ Library v3 is an ongoing project to implement the
65 ISO 14882 Standard C++ library as described in chapters 17 through 27
66 and annex D. As the library reaches stable plateaus, it is captured in
67 a snapshot and released. The current release is [46]the thirteenth
68 snapshot. For those who want to see exactly how far the project has
69 come, or just want the latest bleeding-edge code, the up-to-date
70 source is available over anonymous CVS, and can even be browsed over
73 The older libstdc++-v2 project is no longer maintained; the code has
74 been completely replaced and rewritten. [47]If you are using V2, then
75 you need to report bugs to your system vendor, not to the V3 list.
77 A more formal description of the V3 goals can be found in the official
79 _________________________________________________________________
81 1.2 Why should I use libstdc++?
83 The completion of the ISO C++ standardization gave the C++ community a
84 powerful set of reuseable tools in the form of the C++ Standard
85 Library. However, all existing C++ implementations are (as the Draft
86 Standard used to say) "incomplet and incorrekt," and many suffer from
87 limitations of the compilers that use them.
89 The GNU C/C++/FORTRAN/<pick-a-language> compiler (gcc, g++, etc) is
90 widely considered to be one of the leading compilers in the world. Its
91 development has recently been taken over by the [49]GCC team. All of
92 the rapid development and near-legendary [50]portability that are the
93 hallmarks of an open-source project are being applied to libstdc++.
95 That means that all of the Standard classes and functions (such as
96 string, vector<>, iostreams, and algorithms) will be freely available
97 and fully compliant. Programmers will no longer need to "roll their
98 own" nor be worried about platform-specific incompatibilities.
99 _________________________________________________________________
101 1.3 Who's in charge of it?
103 The libstdc++ project is contributed to by several developers all over
104 the world, in the same way as GCC or Linux. Benjamin Kosnik, Gabriel
105 Dos Reis, Phil Edwards, and Ulrich Drepper are the lead maintainers of
108 Development and discussion is held on the libstdc++ mailing list.
109 Subscribing to the list, or searching the list archives, is open to
110 everyone. You can read instructions for doing so on the [51]homepage.
111 If you have questions, ideas, code, or are just curious, sign up!
112 _________________________________________________________________
114 1.4 How do I get libstdc++?
116 The thirteenth (and latest) snapshot of libstdc++-v3 is [52]available
119 The [53]homepage has instructions for retrieving the latest CVS
120 sources, and for browsing the CVS sources over the web.
122 The subset commonly known as the Standard Template Library (chapters
123 23 through 25, mostly) is adapted from the final release of the SGI
125 _________________________________________________________________
127 1.5 When is libstdc++ going to be finished?
129 Nathan Myers gave the best of all possible answers, responding to a
130 Usenet article asking this question: Sooner, if you help.
131 _________________________________________________________________
133 1.6 How do I contribute to the effort?
135 Here is [54]a page devoted to this topic. Subscribing to the mailing
136 list (see above, or the homepage) is a very good idea if you have
137 something to contribute, or if you have spare time and want to help.
138 Contributions don't have to be in the form of source code; anybody who
139 is willing to help write documentation, for example, or has found a
140 bug in code that we all thought was working, is more than welcome!
141 _________________________________________________________________
143 1.7 What happened to libg++? I need that!
145 The most recent libg++ README states that libg++ is no longer being
146 actively maintained. It should not be used for new projects, and is
147 only being kicked along to support older code.
149 The libg++ was designed and created when there was no Standard to
150 provide guidance. Classes like linked lists are now provided for by
151 list<T> and do not need to be created by genclass. (For that matter,
152 templates exist now and are well-supported, whereas genclass (mostly)
155 There are other classes in libg++ that are not specified in the ISO
156 Standard (e.g., statistical analysis). While there are a lot of really
157 useful things that are used by a lot of people (e.g., statistics :-),
158 the Standards Committee couldn't include everything, and so a lot of
159 those "obvious" classes didn't get included.
161 Since libstdc++ is an implementation of the Standard Library, we have
162 no plans at this time to include non-Standard utilities in the
163 implementation, however handy they are. (The extensions provided in
164 the SGI STL aren't maintained by us and don't get a lot of our
165 attention, because they don't require a lot of our time.) It is
166 entirely plausable that the "useful stuff" from libg++ might be
167 extracted into an updated utilities library, but nobody has stated
170 (The [55]Boost site houses free C++ libraries that do varying things,
171 and happened to be started by members of the Standards Committee.
172 Certain "useful stuff" classes will probably migrate there.)
174 For the bold and/or desperate, the [56]GCC FAQ describes where to find
175 the last libg++ source.
176 _________________________________________________________________
178 1.8 What if I have more questions?
180 If you have read the README and RELEASE-NOTES files, and your question
181 remains unanswered, then just ask the mailing list. At present, you do
182 not need to be subscribed to the list to send a message to it. More
183 information is available on the homepage (including how to browse the
184 list archives); to send to the list, use [57]libstdc++@gcc.gnu.org.
186 If you have a question that you think should be included here, or if
187 you have a question about a question/answer here, contact [58]Phil
188 Edwards or [59]Gabriel Dos Reis.
189 _________________________________________________________________
191 1.9 What are the license terms for libstdc++-v3?
193 See [60]our license description for these and related questions.
194 _________________________________________________________________
198 2.1 How do I install libstdc++-v3?
200 Complete instructions are not given here (this is a FAQ, not an
201 installation document), but the tools required are few:
202 * A 3.x release of GCC. Note that building GCC is much easier and
203 more automated than building the GCC 2.[78] series was. If you are
204 using GCC 2.95, you can still build earlier snapshots of
206 * GNU Make is recommended, but should not be required.
207 * The GNU Autotools are needed if you are messing with the configury
210 The file [61]documentation.html provides a good overview of the steps
211 necessary to build, install, and use the library. Instructions for
212 configuring the library with new flags such as --enable-threads are
213 there also, as well as patches and instructions for working with GCC
216 The top-level install.html and [62]RELEASE-NOTES files contain the
217 exact build and installation instructions. You may wish to browse
218 those files over CVSweb ahead of time to get a feel for what's
219 required. RELEASE-NOTES is located in the ".../docs/17_intro/"
220 directory of the distribution.
221 _________________________________________________________________
225 This question has become moot and has been removed. The stub is here
226 to preserve numbering (and hence links/bookmarks).
227 _________________________________________________________________
229 2.3 What is this CVS thing that you keep mentioning?
231 The Concurrent Versions System is one of several revision control
232 packages. It was selected for GNU projects because it's free (speech),
233 free (beer), and very high quality. The [63]CVS entry in the GNU
234 software catalogue has a better description as well as a [64]link to
237 The "anonymous client checkout" feature of CVS is similar to anonymous
238 FTP in that it allows anyone to retrieve the latest libstdc++ sources.
240 After the first of April, American users will have a "/pharmacy"
241 command-line option...
242 _________________________________________________________________
244 2.4 How do I know if it works?
246 libstdc++-v3 comes with its own testsuite. You do not need to actually
247 install the library ("make install") to run the testsuite.
249 To run the testsuite on the library after building it, use "make
250 check" while in your build directory. To run the testsuite on the
251 library after building and installing it, use "make check-install"
254 If you find bugs in the testsuite programs themselves, or if you think
255 of a new test program that should be added to the suite, please write
256 up your idea and send it to the list!
257 _________________________________________________________________
259 2.4 This library is HUGE! And what's libsupc++?
261 Usually the size of libraries on disk isn't noticeable. When a link
262 editor (or simply "linker") pulls things from a static archive
263 library, only the necessary object files are copied into your
264 executable, not the entire library. Unfortunately, even if you only
265 need a single function or variable from an object file, the entire
266 object file is extracted. (There's nothing unique to C++ or
267 libstdc++-v3 about this; it's just common behavior, given here for
270 Some of the object files which make up libstdc++.a are rather large.
271 If you create a statically-linked executable with -static, those large
272 object files are suddenly part of your executable. Historically the
273 best way around this was to only place a very few functions (often
274 only a single one) in each source/object file; then extracting a
275 single function is the same as extracting a single .o file. For
276 libstdc++-v3 this is only possible to a certain extent; the object
277 files in question contain template classes and template functions,
278 pre-instantiated, and splitting those up causes severe maintenance
281 It's not a bug, and it's not really a problem. Nevertheless, some
282 people don't like it, so here are two pseudo-solutions:
284 If the only functions from libstdc++.a which you need are language
285 support functions (those listed in [65]clause 18 of the standard,
286 e.g., new and delete), then try linking against libsupc++.a (usually
287 specifying -lsupc++ when calling g++ for the final link step will do
288 it). This library contains only those support routines, one per object
289 file. But if you are using anything from the rest of the library, such
290 as IOStreams or vectors, then you'll still need pieces from
293 The second method is one we hope to incorporate into the library build
294 process. Some platforms can place each function and variable into its
295 own section in a .o file. The GNU linker can then perform garbage
296 collection on unused sections; this reduces the situation to only
297 copying needed functions into the executable, as before, but all
298 happens automatically.
300 Unfortunately the garbage collection in GNU ld is buggy; sections
301 (corresponding to functions and variables) which are used are
302 mistakenly removed, leading to horrible crashes when your executable
303 starts up. For the time being, this feature is not used when building
305 _________________________________________________________________
307 3.0 Platform-Specific Issues
309 3.1 Can libstdc++-v3 be used with <my favorite compiler>?
313 Because GCC advances so rapidly, development and testing of libstdc++
314 is being done almost entirely under that compiler. If you are curious
315 about whether other, lesser compilers (*grin*) support libstdc++, you
316 are more than welcome to try. Configuring and building the library
317 (see above) will still require certain tools, however. Also keep in
318 mind that building libstdc++ does not imply that your compiler will be
319 able to use all of the features found in the C++ Standard Library.
321 Since the goal of ISO Standardization is for all C++ implementations
322 to be able to share code, the final libstdc++ should, in theory, be
323 usable under any ISO-compliant compiler. It will still be targeted and
324 optimized for GCC/g++, however.
325 _________________________________________________________________
329 This question has become moot and has been removed. The stub is here
330 to preserve numbering (and hence links/bookmarks).
331 _________________________________________________________________
333 3.3 Building DEC OSF kills the assembler
335 The atomicity.h header for the Alpha processor currently uses
336 pseudo-operators which the DEC assembler doesn't understand (in
337 particular, .subsection and .previous). The simple solution is to
338 install GNU as and arrange for the GCC build to use it (or merge the
339 sources and build it during the bootstrap).
341 Anyone who [66]knows the DEC assembler well enough to provide the
342 equivalent of these two pseudos would win praise and accolades from
344 _________________________________________________________________
346 3.4 I can't use 'long long' on Solaris
348 By default we try to support the C99 long long type. This requires
349 that certain functions from your C library be present.
351 Up through release 3.0.2 the tests performed were too general, and
352 this feature was disabled when it did not need to be. The most
353 commonly reported platform affected was Solaris.
355 This has been fixed for 3.0.3 and onwards.
356 _________________________________________________________________
358 4.0 Known Bugs and Non-Bugs
360 Note that this section can get rapdily outdated -- such is the nature
361 of an open-source project. For the latest information, join the
362 mailing list or look through recent archives. The RELEASE- NOTES and
363 BUGS files are generally kept up-to-date.
365 For 3.0.1, the most common "bug" is an apparently missing "../" in
366 include/Makefile, resulting in files like gthr.h and gthr-single.h not
369 Please read [67]the configuration instructions for GCC, specifically
370 the part about configuring in a separate build directory, and how
371 strongly recommended it is. Building in the source directory is
372 fragile, is rarely tested, and tends to break, as in this case. This
375 Please do not report these as bugs. We know about them. Reporting this
376 -- or any other problem that's already been fixed -- hinders the
377 development of GCC, because we have to take time to respond to your
380 4.1 What works already?
382 This is a verbatim clip from the "Status" section of the RELEASE-NOTES
383 for the latest snapshot. For a list of fixed bugs, see that file.
386 - more doxygen documentation.
387 - extensions moved out of namespace std
388 - HPUX long long support
389 - more string optimizations
390 - support for NetBSD cross compiles
391 - concept_check merge from boost
392 - header simplification
393 - named locale bug shakeout
398 - add S390, m68k, x86-64 support.
399 - doxygen documentation has been extended, including man pages.
400 - verbose terminate handling has been added.
401 - some libsupc++ tweaks
402 - warnings for deprecated headers now active.
403 - dejagnu testsuite preliminary documentation.
404 - dejagnu testsuite default.
405 - dejagnu testsuite cross compiler, multilib safe.
406 - long long iostreams on by default, rework of ISO C99 support.
407 - iterator re-write and testsuites.
408 - container testsuites.
409 - allocator revamp and testsuites.
410 - more concept-checking work.
411 - basic_string optimization and MT fixes.
412 - new limits implementation.
413 - update -fno-exceptions code, verify it works.
414 - full named locale support fpr all facets, choice of gnu,
415 ieee_1003.1-200x (POSIX 2), or generic models. Full support depends
416 on target OS and underlying "C" library support.
417 _________________________________________________________________
419 4.2 Bugs in gcc/g++ (not libstdc++-v3)
421 This is by no means meant to be complete nor exhaustive, but mentions
422 some problems that users may encounter when building or using
423 libstdc++. If you are experiencing one of these problems, you can find
424 more information on the libstdc++ and the GCC mailing lists.
425 * As of 3.0.95, those bugs have all been fixed. We look forward to
426 new ones, well, not exactly... Existing bugs are listed in the
427 BUGS file, and the GCC GNATS database.
428 _________________________________________________________________
430 4.3 Bugs in the C++ language/lib specification
432 Yes, unfortunately, there are some. In a [68]message to the list,
433 Nathan Myers announced that he has started a list of problems in the
434 ISO C++ Standard itself, especially with regard to the chapters that
435 concern the library. The list itself is [69]posted on his website.
436 Developers who are having problems interpreting the Standard may wish
437 to consult his notes.
439 For those people who are not part of the ISO Library Group (i.e.,
440 nearly all of us needing to read this page in the first place :-), a
441 public list of the library defects is occasionally published [70]here.
442 Some of these have resulted in [71]code changes.
443 _________________________________________________________________
445 4.4 Things in libstdc++ that look like bugs
447 There are things which are not bugs in the compiler (4.2) nor the
448 language specification (4.3), but aren't really bugs in libstdc++,
449 either. Really! Please do not report these as bugs.
451 -Weffc++ The biggest of these is the quadzillions of warnings about
452 the library headers emitted when -Weffc++ is used. Making libstdc++
453 "-Weffc++-clean" is not a goal of the project, for a few reasons.
454 Mainly, that option tries to enforce object-oriented programming,
455 while the Standard Library isn't necessarily trying to be OO. There
456 are multiple solutions under discussion.
458 reopening a stream fails Did I just say that -Weffc++ was our biggest
459 false-bug report? I lied. (It used to be.) Today it seems to be
460 reports that after executing a sequence like
463 std::fstream fs("a_file");
465 // . do things with fs...
468 fs.open("a_new_file");
470 all operations on the re-opened fs will fail, or at least act very
471 strangely. Yes, they often will, especially if fs reached the EOF
472 state on the previous file. The reason is that the state flags are not
473 cleared on a successful call to open(). The standard unfortunately did
474 not specify behavior in this case, and to everybody's great sorrow,
475 the [72]proposed LWG resolution (see DR #22) is to leave the flags
476 unchanged. You must insert a call to fs.clear() between the calls to
477 close() and open(), and then everything will work like we all expect
480 rel_ops Another is the rel_ops namespace and the template comparison
481 operator functions contained therein. If they become visible in the
482 same namespace as other comparison functions (e.g., 'using' them and
483 the <iterator> header), then you will suddenly be faced with huge
484 numbers of ambiguity errors. This was discussed on the -v3 list;
485 Nathan Myers [73]sums things up here.
487 The g++-3 headers are not ours
489 If you have found an extremely broken header file which is causing
490 problems for you, look carefully before submitting a "high" priority
491 bug report (which you probably shouldn't do anyhow; see the last
492 paragraph of the page describing [74]the GCC bug database).
494 If the headers are in ${prefix}/include/g++-3, or if the installed
495 library's name looks like libstdc++-2.10.a or libstdc++-libc6-2.10.so,
496 then you are using the old libstdc++-v2 library, which is nonstandard
497 and unmaintained. Do not report problems with -v2 to the -v3 mailing
500 Currently our header files are installed in ${prefix}/include/g++-v3
501 (see the 'v'?). This may change with the next release of GCC, as it
502 may be too confusing, but [75]the question has not yet been decided.
504 glibc If you're on a GNU/Linux system and have just upgraded to glibc
505 2.2, but are still using gcc 2.95.2, then you should have read the
506 glibc FAQ, specifically 2.34:
507 2.34. When compiling C++ programs, I get a compilation error in streambuf.h.
509 {BH} You are using g++ 2.95.2? After upgrading to glibc 2.2, you need to
510 apply a patch to the include files in /usr/include/g++, because the fpos_t
511 type has changed in glibc 2.2. The patch is at
512 http://clisp.cons.org/~haible/gccinclude-glibc-2.2-compat.diff
515 Note that 2.95.x shipped with the [76]old v2 library which is no
516 longer maintained. Also note that gcc 2.95.3 fixes this problem, but
517 requires a separate patch for libstdc++-v3.
519 concept checks If you see compilation errors containing messages about
520 fooConcept and a constraints member function, then most likely you
521 have violated one of the requirements for types used during
522 instantiation of template containers and functions. For example,
523 EqualityComparableConcept appears if your types must be comparable
524 with == and you have not provided this capability (a typo, or wrong
525 visibility, or you just plain forgot, etc).
527 More information, including how to optionally enable/disable the
528 checks, is available [77]here.
529 _________________________________________________________________
531 4.5 Aw, that's easy to fix!
533 If you have found a bug in the library and you think you have a
534 working fix, then send it in! The main GCC site has a page on
535 [78]submitting patches that covers the procedure, but for libstdc++
536 you should also send the patch to our mailing list in addition to the
537 GCC patches mailing list. The libstdc++ [79]contributors' page also
538 talks about how to submit patches.
540 In addition to the description, the patch, and the ChangeLog entry, it
541 is a Good Thing if you can additionally create a small test program to
542 test for the presence of the bug that your patch fixes. Bugs have a
543 way of being reintroduced; if an old bug creeps back in, it will be
544 caught immediately by the [80]testsuite -- but only if such a test
546 _________________________________________________________________
550 5.1 string::iterator is not char*; vector<T>::iterator is not T*
552 If you have code that depends on container<T> iterators being
553 implemented as pointer-to-T, your code is broken.
555 While there are arguments for iterators to be implemented in that
556 manner, A) they aren't very good ones in the long term, and B) they
557 were never guaranteed by the Standard anyway. The type-safety achieved
558 by making iterators a real class rather than a typedef for T*
559 outweighs nearly all opposing arguments.
561 Code which does assume that a vector iterator i is a pointer can often
562 be fixed by changing i in certain expressions to &*i . Future
563 revisions of the Standard are expected to bless this usage for
564 vector<> (but not for basic_string<>).
565 _________________________________________________________________
567 5.2 What's next after libstdc++-v3?
569 Hopefully, not much. The goal of libstdc++-v3 is to produce a
570 fully-compliant, fully-portable Standard Library. After that, we're
571 mostly done: there won't be any more compliance work to do. However:
572 1. The ISO Committee will meet periodically to review Defect Reports
573 in the C++ Standard. Undoubtedly some of these will result in
574 changes to the Standard, which will be reflected in patches to
575 libstdc++. Some of that is already happening, see 4.2. Some of
576 those changes are being predicted by the library maintainers, and
577 we add code to the library based on what the current proposed
578 resolution specifies. Those additions are listed in [81]the
580 2. Performance tuning. Lots of performance tuning. This too is
581 already underway for post-3.0 releases, starting with memory
582 expansion in container classes and buffer usage in synchronized
584 3. An ABI for libstdc++ will eventually be developed, so that
585 multiple binary-incompatible copies of the library can be replaced
586 with a single backwards-compatible library, like libgcc_s.so is.
587 4. The current libstdc++ contains extensions to the Library which
588 must be explicitly requested by client code (for example, the hash
589 tables from SGI). Other extensions may be added to libstdc++-v3 if
590 they seem to be "standard" enough. (For example, the "long long"
591 type from C99.) Bugfixes and rewrites (to improve or fix thread
592 safety, for instance) will of course be a continuing task.
594 [82]This question about the next libstdc++ prompted some brief but
595 interesting [83]speculation.
596 _________________________________________________________________
598 5.3 What about the STL from SGI?
600 The [84]STL from SGI, version 3.3, was the most recent merge of the
601 STL codebase. The code in libstdc++ contains many fixes and changes,
602 and it is very likely that the SGI code is no longer under active
603 development. We expect that no future merges will take place.
605 In particular, string is not from SGI and makes no use of their "rope"
606 class (which is included as an optional extension), nor is valarray
607 and some others. Classes like vector<> are, however.
609 The FAQ for SGI's STL (one jump off of their main page) is recommended
611 _________________________________________________________________
613 5.4 Extensions and Backward Compatibility
615 Although you can specify -I options to make the preprocessor search
616 the g++-v3/ext and /backward directories, it is better to refer to
617 files there by their path, as in:
618 #include <ext/hash_map>
621 Extensions to the library have [85]their own page.
622 _________________________________________________________________
626 This question has become moot and has been removed. The stub is here
627 to preserve numbering (and hence links/bookmarks).
628 _________________________________________________________________
630 5.6 Is libstdc++-v3 thread-safe?
632 When the system's libc is itself thread-safe, a non-generic
633 implementation of atomicity.h exists for the architecture, and gcc
634 itself reports a thread model other than single; libstdc++-v3 strives
635 to be thread-safe. The user-code must guard against concurrent method
636 calls which may access any particular library object's state.
637 Typically, the application programmer may infer what object locks must
638 be held based on the objects referenced in a method call. Without
639 getting into great detail, here is an example which requires
641 library_class_a shared_object_a;
644 library_class_b *object_b = new library_class_b;
645 shared_object_a.add_b (object_b); // must hold lock for shared_object_
647 shared_object_a.mutate (); // must hold lock for shared_object_
651 // Multiple copies of thread_main() are started in independent threads.
653 Under the assumption that object_a and object_b are never exposed to
654 another thread, here is an example that should not require any
657 library_class_a object_a;
658 library_class_b *object_b = new library_class_b;
659 object_a.add_b (object_b);
663 All library objects are safe to use in a multithreaded program as long
664 as each thread carefully locks out access by any other thread while it
665 uses any object visible to another thread. In general, this
666 requirement includes both read and write access to objects; unless
667 otherwise documented as safe, do not assume that two threads may
668 access a shared standard library object at the same time.
670 See chapters [86]17 (library introduction), [87]23 (containers), and
671 [88]27 (I/O) for more information.
672 _________________________________________________________________
674 5.7 How do I get a copy of the ISO C++ Standard?
676 Copies of the full ISO 14882 standard are available on line via the
677 ISO mirror site for committee members. Non-members, or those who have
678 not paid for the privilege of sitting on the committee and sustained
679 their two-meeting commitment for voting rights, may get a copy of the
680 standard from their respective national standards organization. In the
681 USA, this national standards organization is ANSI and their website is
682 right [89]here. (And if you've already registered with them, clicking
683 this link will take you to directly to the place where you can [90]buy
684 the standard on-line.
686 Who is your country's member body? Visit the [91]ISO homepage and find
688 _________________________________________________________________
690 5.8 What's an ABI and why is it so messy?
692 "ABI" stands for "Application Binary Interface." Conventionally, it
693 refers to a great mass of details about how arguments are arranged on
694 the call stack and/or in registers, and how various types are arranged
695 and padded in structs. A single CPU design may suffer multiple ABIs
696 designed by different development tool vendors who made different
697 choices, or even by the same vendor for different target applications
698 or compiler versions. In ideal circumstances the CPU designer presents
699 one ABI and all the OSes and compilers use it. In practice every ABI
700 omits details that compiler implementers (consciously or accidentally)
701 must choose for themselves.
703 That ABI definition suffices for compilers to generate code so a
704 program can interact safely with an OS and its lowest-level libraries.
705 Users usually want an ABI to encompass more detail, allowing libraries
706 built with different compilers (or different releases of the same
707 compiler!) to be linked together. For C++, this includes many more
708 details than for C, and CPU designers (for good reasons elaborated
709 below) have not stepped up to publish C++ ABIs. The details include
710 virtual function implementation, struct inheritance layout, name
711 mangling, and exception handling. Such an ABI has been defined for GNU
712 C++, and is immediately useful for embedded work relying only on a
713 "free-standing implementation" that doesn't include (much of) the
714 standard library. It is a good basis for the work to come.
716 A useful C++ ABI must also incorporate many details of the standard
717 library implementation. For a C ABI, the layouts of a few structs
718 (such as FILE, stat, jmpbuf, and the like) and a few macros suffice.
719 For C++, the details include the complete set of names of functions
720 and types used, the offsets of class members and virtual functions,
721 and the actual definitions of all inlines. C++ exposes many more
722 library details to the caller than C does. It makes defining a
723 complete ABI a much bigger undertaking, and requires not just
724 documenting library implementation details, but carefully designing
725 those details so that future bug fixes and optimizations don't force
728 There are ways to help isolate library implementation details from the
729 ABI, but they trade off against speed. Library details used in inner
730 loops (e.g., getchar) must be exposed and frozen for all time, but
731 many others may reasonably be kept hidden from user code, so they may
732 later be changed. Deciding which, and implementing the decisions, must
733 happen before you can reasonably document a candidate C++ ABI that
734 encompasses the standard library.
735 _________________________________________________________________
737 See [92]license.html for copying conditions. Comments and suggestions
738 are welcome, and may be sent to [93]the libstdc++ mailing list.
742 1. http://gcc.gnu.org/onlinedocs/libstdc++/faq/
743 2. http://gcc.gnu.org/onlinedocs/libstdc++/documentation.html
744 3. http://gcc.gnu.org/libstdc++/
745 4. ../faq/index.html#1_0
746 5. ../faq/index.html#1_1
747 6. ../faq/index.html#1_2
748 7. ../faq/index.html#1_3
749 8. ../faq/index.html#1_4
750 9. ../faq/index.html#1_5
751 10. ../faq/index.html#1_6
752 11. ../faq/index.html#1_7
753 12. ../faq/index.html#1_8
754 13. ../faq/index.html#1_9
755 14. ../faq/index.html#2_0
756 15. ../faq/index.html#2_1
757 16. ../faq/index.html#2_2
758 17. ../faq/index.html#2_3
759 18. ../faq/index.html#2_4
760 19. ../faq/index.html#2_5
761 20. ../faq/index.html#3_0
762 21. ../faq/index.html#3_1
763 22. ../faq/index.html#3_2
764 23. ../faq/index.html#3_3
765 24. ../faq/index.html#3_4
766 25. ../faq/index.html#4_0
767 26. ../faq/index.html#4_1
768 27. ../faq/index.html#4_2
769 28. ../faq/index.html#4_3
770 29. ../faq/index.html#4_4
771 30. ../faq/index.html#4_4_iostreamclear
772 31. ../faq/index.html#4_4_Weff
773 32. ../faq/index.html#4_4_rel_ops
774 33. ../faq/index.html#4_4_interface
775 34. ../faq/index.html#4_4_glibc
776 35. ../faq/index.html#4_4_checks
777 36. ../faq/index.html#4_5
778 37. ../faq/index.html#5_0
779 38. ../faq/index.html#5_1
780 39. ../faq/index.html#5_2
781 40. ../faq/index.html#5_3
782 41. ../faq/index.html#5_4
783 42. ../faq/index.html#5_5
784 43. ../faq/index.html#5_6
785 44. ../faq/index.html#5_7
786 45. ../faq/index.html#5_8
787 46. http://gcc.gnu.org/libstdc++/download.html
788 47. ../faq/index.html#4_4_interface
789 48. ../17_intro/DESIGN
790 49. http://gcc.gnu.org/
791 50. http://gcc.gnu.org/gcc-2.95/buildstat.html
792 51. http://gcc.gnu.org/libstdc++/
793 52. http://gcc.gnu.org/libstdc++/download.html
794 53. http://gcc.gnu.org/libstdc++/
795 54. ../17_intro/contribute.html
796 55. http://www.boost.org/
797 56. http://gcc.gnu.org/fom_serv/cache/33.html
798 57. mailto:libstdc++@gcc.gnu.org
799 58. mailto:pme@gcc.gnu.org
800 59. mailto:gdr@gcc.gnu.org
801 60. ../17_intro/license.html
802 61. ../documentation.html
803 62. ../17_intro/RELEASE-NOTES
804 63. http://www.gnu.org/software/cvs/cvs.html
805 64. http://www.cvshome.org/
806 65. ../18_support/howto.html
807 66. http://gcc.gnu.org/ml/libstdc++/2000-12/msg00279.html
808 67. http://gcc.gnu.org/install/configure.html
809 68. http://gcc.gnu.org/ml/libstdc++/1998/msg00006.html
810 69. http://www.cantrip.org/draft-bugs.txt
811 70. http://anubis.dkuug.dk/jtc1/sc22/wg21/
812 71. ../faq/index.html#5_2
813 72. ../ext/howto.html#5
814 73. http://gcc.gnu.org/ml/libstdc++/2001-01/msg00247.html
815 74. http://gcc.gnu.org/gnatswrite.html
816 75. http://gcc.gnu.org/ml/gcc/2000-10/msg00732.html
817 76. ../faq/index.html#4_4_interface
818 77. ../19_diagnostics/howto.html#3
819 78. http://gcc.gnu.org/contribute.html
820 79. ../17_intro/contribute.html
821 80. ../faq/index.html#2_4
822 81. ../ext/howto.html#5
823 82. http://gcc.gnu.org/ml/libstdc++/1999/msg00080.html
824 83. http://gcc.gnu.org/ml/libstdc++/1999/msg00084.html
825 84. http://www.sgi.com/Technology/STL/
826 85. ../ext/howto.html
827 86. ../17_intro/howto.html#3
828 87. ../23_containers/howto.html#3
829 88. ../27_io/howto.html#9
830 89. http://www.ansi.org/
831 90. http://webstore.ansi.org/ansidocstore/product.asp?sku=ISO%2FIEC+14882%2D1998
832 91. http://www.iso.ch/
833 92. ../17_intro/license.html
834 93. mailto:libstdc++@gcc.gnu.org