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