howto.html: Update some links.
[official-gcc.git] / libstdc++-v3 / docs / html / explanations.html
blob5a60b910dce2be575059704be25252348b282d5c
1 <?xml version="1.0" encoding="ISO-8859-1"?>
2 <!DOCTYPE html
3 PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
6 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7 <head>
8 <meta name="AUTHOR" content="pme@gcc.gnu.org (Phil Edwards)" />
9 <meta name="KEYWORDS" content="libstdc++, libstdc++-v3, GCC, g++" />
10 <meta name="DESCRIPTION" content="Explanatory notes about libstdc++-v3." />
11 <meta name="GENERATOR" content="vi and eight fingers" />
12 <title>Explanatory notes about libstdc++-v3 design</title>
13 <link rel="StyleSheet" href="lib3styles.css" />
14 </head>
15 <body>
17 <h1 class="centered"><a name="top">Explanatory notes about libstdc++-v3
18 design</a></h1>
20 <p class="fineprint"><em>
21 The latest version of this document is always available at
22 <a href="http://gcc.gnu.org/onlinedocs/libstdc++/explanations.html">
23 http://gcc.gnu.org/onlinedocs/libstdc++/explanations.html</a>.
24 </em></p>
26 <p><em>
27 To the <a href="http://gcc.gnu.org/libstdc++/">libstdc++-v3 homepage</a>.
28 </em></p>
31 <!-- ####################################################### -->
32 <hr />
33 <h3><a name="cstdio">&quot;I/O packages&quot;, <code>--enable-cstdio</code></a></h3>
34 <p>In addition to all the nifty things which C++ can do for I/O, its library
35 also includes all of the I/O capabilites of C. Making them work together
36 can be a challenge, not only
37 <a href="27_io/howto.html#8">for the programmer</a> but for the
38 implementors as well.
39 </p>
40 <p>There are two ways to do a C++ library: the cool way, and the easy way.
41 More specifically, the cool-but-easy-to-get-wrong way, and the
42 easy-to-guarantee-correct-behavior way. For 3.0, the easy way is used.
43 </p>
44 <p>Choosing 'stdio' is the easy way. It builds a C++ library which forwards
45 all operations to the C library. Many of the C++ I/O functions are
46 specified in the standard 'as if' they called a certain C function; the
47 easiest way to get it correct is to actually call that function. The
48 disadvantage is that the C++ code will run slower (fortunately, the layer
49 is thin).
50 </p>
51 <p>Choosing 'libio' is the cool way; it allows C++ and C to share some
52 buffers. It's disabled because of tricky synchronization issues. Other
53 cool ways (various methods of sharing resources between C and C++
54 facilities, instead of layering) are possible. This approach can speed
55 up I/O significantly.
56 </p>
57 <p>Other packages are possible. For a new package, a header must be
58 written to provide types like streamsize (usually just a typedef), as
59 well as some internal types like<code> __c_file_type </code> and
60 <code> __c_lock </code> (for the stdio case, these are FILE (as in
61 &quot;FILE*&quot;) and a simple POSIX mutex, respectively). An
62 interface class called <code> __basic_file </code> must also be filled in;
63 as an example, for the stdio case, these member functions are all
64 inline calles to fread, fwrite, etc.
65 </p>
66 <p>Return <a href="#top">to the top of the page</a> or
67 <a href="http://gcc.gnu.org/libstdc++/">to the homepage</a>.
68 </p>
71 <hr />
72 <h3><a name="alloc">Internal Allocators</a></h3>
73 <p>
74 </p>
75 <p>Return <a href="#top">to the top of the page</a> or
76 <a href="http://gcc.gnu.org/libstdc++/">to the homepage</a>.
77 </p>
80 <!-- ####################################################### -->
82 <hr />
83 <p class="fineprint"><em>
84 See <a href="17_intro/license.html">license.html</a> for copying conditions.
85 Comments and suggestions are welcome, and may be sent to
86 <a href="mailto:libstdc++@gcc.gnu.org">the libstdc++ mailing list</a>.
87 </em></p>
90 </body>
91 </html>