Boost logo

Boost :

From: Paul Mensonides (pmenso57_at_[hidden])
Date: 2005-10-21 16:08:46


> -----Original Message-----
> From: boost-bounces_at_[hidden]
> [mailto:boost-bounces_at_[hidden]] On Behalf Of David Abrahams
> >> > 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.
>
> I'm also more inclined towards the macro version (with Paul's
> suggested name change), although if we got some of the MPL
> interoperability things that Andy Little mentioned, and of
> course the absolutely _essential_ documentation, I might be
> inclined the other way.

I think a template-based version is unacceptable for one primary reason. To the
template mechanism, 001 and 0001 are the same thing. That is a bad thing when
specifying groups of binary bits, as the groupings are often not simple four-bit
groupings. The macro version can differentiate between the two, and can specify
any pattern of bit groups. Other then the ability to tack UL (etc.) onto the
end, it isn't a great strength that the macro produces a literal--only that it
produces a compile-time constant suitably typed. IMO, as far as this is
concerned, the template-based version and the macro-based version are
more-or-less equivalent. The great strength of the macro version is the support
for arbitrary bit groupings.

Regards,
Paul Mensonides


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