Boost logo

Boost :

From: Ed Brey (brey_at_[hidden])
Date: 2000-11-29 01:33:11


1. cstdint.hpp defines the macro BOOST__STDC_CONSTANT_MACROS_DEFINED, which
has a double underscore. IIRC, double underscores are always reserved for
the implementation, even within a name. Is this intentional? It is right
next to __STDC_CONSTANT_MACROS, so maybe so. Somehow I missed out on the
rationale behind why the name __STDC_CONSTANT_MACROS is used for the macro
to enable/disable the constant macros. It would be nice to have that
documented. Without a knowledge of an existing commitment by the standard
to use that name with the desired semantics, it would seem dangerous to
trigger off that macro rather than a "namespaced" (boost-prefixed) macro for
the same reason that it would be bad to put the boost declarations into
namespace std.

2. The way the INTXX_C macros are defined was quite astonishing to me and
took quite some time for me to figure out (although the system seems pretty
cool once I got it). Perhaps it is because I wasn't familiar with what
cassert (which is referenced by cstdint.hpp's comments) is supposed to do,
since under STLport on VC, there is no magic to allow the macros to be
turned on or off (and I don't have a stanard in front of me at the moment).
Documentation of the macros in the html file would help, including a mention
that they can be turned on and off at will within a single translation unit.
Also a comment indicating that the BOOST_CSTDINT_HPP macro guard
intentionally does not surround the entire file would be helpful (I almost
reported that fact as a bug).

3. Why are the guards a la "#if UCHAR_MAX == 0xff" around the old-fashioned
constant macros necessary? Even if UCHAR_MAX doesn't work out to 8 bits,
how can you go wrong casting to uint8_t? Whatever type uint8_t works out to
will be the right type.

4. There was previous discussion regarding a nested namespace for integer
types; however, that didn't seem to make it into the latest version of
cstdint.hpp. I'd propose the following addition to provide the nested
namespace to those who use it without causing any effect on those who don't.
Before the close of the boost namespace, include:

namespace integer {
     using int8_t; using int_least8_t; using int_fast8_t; using uint8_t;
using uint_least8_t; using uint_fast8_t;
    // ... and so on for 16, 32, and 64 bit, intmax_t, and intmin_t.
}

IMHO, the same technique and nested namespace should be used in integer.hpp.


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