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