Boost logo

Boost :

From: John Maddock (John_Maddock_at_[hidden])
Date: 2000-12-15 07:30:32


As well as the perennial problem of a missing <limits> there are problems
appearing with non-standard (old style) iostreams, and missing <cheader>
files, as a starting suggestion how about the following workaround:

we add a "fixes" subdirectory containing the missing files, the directory
structure would look something like this:

<boost-root>
        fixes/
                limits/
                        limits - for systems with no <limits>
                clib/
                        cstdlib
                        cstring
                        // etc
                streams/
                        iostream
                        fstream
                        //etc

In use the user can either copy the necessary files to their include path
or just add the directories required to their compiler's include search
path (whichever is easier on the platform). More detailed descriptions
follow:

**** limits ****

Just a boostified SGI limits file (see boost/pending/limits.hpp - thanks
Jeremy!).

***** clib ******

simple wrappers that #include the name.h version, and #undef all function
prototypes (we must have real ANSI C prototypes and not macros, in order to
use the std::foo syntax). These files do not add the "using workaround"
for the following reasons:

1) The declartions may be in namespace std already on some systems even
though the new header names are missing.
2) We don't know which declarations are present - wide character string
support can vary considerably from platform to platform for example.
Adding #ifdef's presents a maintainence nightmare, STLPort makes a valient
attempt here, but still doesn't succeed all that well IMO.
3) Boost libraries are already required to implement the "using workaround"
internally for VC6 support, more to the point, boost libraries know which
C-library functions they call, and therefore exactly which declarations
need to be imported into std.

**** streams ****

Although it's possible to write a set of workaround headers like this:

#include <iostreams>

namespace std{
using ::cout;
using ::cin;
using ::cerr;
//etc
}

this is typically broken by test programs that do either:

#include <iostream>
using namespace std;

or do:

#include <iostream>
using std::cout;

We therefore need a set of coding guidelines to go with this, something
like this:

All test and example programs that use iostreams are required to follow one
or the other of the rules below, but never mix both rules in the same
program:

Rule 1:
Honor the status of the macro BOOST_NO_NEW_IOSTREAM, and import
declarations in std into the global namespace only if required, for example
a program may begin with:

#ifndef BOOST_NO_NEW_IOSTREAM
#include <iostream>
using std::cout;
using std::endl;
#else
#include <iostream.h>
#endif

Rule 2:
Always include the new style iostream headers, and prefix all iostream
identifiers with the std:: qualifier, never import iostream names into the
global namespace.

Comments?

- John.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk