Boost logo

Boost :

From: Alexander Nasonov (alnsn-boost_at_[hidden])
Date: 2005-10-21 05:10:15


Pavel Vozenilek <pavel_vozenilek <at> hotmail.com> writes:

>
> Reviews of binary int utility are needed. The tool is very small (but
> useful) and review should not take much of time. Both Scott Schurr and Matt
> Calabrese put quite a lot of effort into their work.
>
> Scott Schurr's version is in http://boost-consulting.com/vault/ (file
> binary_int.zip).
> It can be used as:
> unsigned int regValue2 = binary_int<1000,1001,0011,0000>::value;

I vote not to accept this library for the following reasons:

1. No documentation
2. It's not clear whether it's supposed to be an int constant or a literal.
   These are different things. The former is always int while the latter
   has different types depending on constant's value. Refer to 2.13.1/2.
2a. If it's supposed to be an int constant, then I expect one class
    template for every integral type.
2b. If it's supposed to be a literal, then it should obey 2.13.1/2 rules
    as if the literal were octal.
3. I expect integration with MPL.

> Matt Calabrese's version is in
> http://www.illegal-immigration.com/Riv/boost/binary_literal2.hpp.
> It can be used as:
> int x = BOOST_BINARY_LITERAL( 101 0111 1010 0110 );

This version looks better to me. There is no contradiction with 2.13.1/2 rules.
I don't like BOOST_SUFFIXED_BINARY_LITERAL much, though. Is it possible to get
rid of it and to use BOOST_BINARY_LITERAL( 0000 0110U ) instead?

--
Alexander Nasonov

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