Boost logo

Boost :

From: Darin Adler (darin_at_[hidden])
Date: 2001-09-21 19:21:32

on 9/21/01 2:24 PM, Fernando Cacciola at fcacciola_at_[hidden] wrote:

> * I don't have any 'boost\limits.hpp'. I have installed boost 1.21.1, which
> I believe is the latest release.

The latest release is 1.24.0 and it does include <boost/limits.hpp>. See
<> for information about the latest releases.

> * The template parameters specifying the number of bits is of type 'int'. I
> think it should be 'std::size_t'.

I don't agree. There's no special reason to use size_t for numbers of bits.

> * What's the idea of the 'do { ... } while ( false ) ; ' construct?

That's a standard C macro idiom for turning a set of statements into a
single statement. It prevents problems with hanging ifs. Here's a simplified

    #define CALL_IF_0(num, func) if (!num) func()

    if (b)
        CALL_IF_0(n, f);

In the code above, the else gets attached to the if statement inside the
macro. The do while false idiom fixes this:

    #define CALL_IF_0(num, func) do { if (!num) func() } while (false)

    if (b)
        CALL_IF_0(n, f);

The else gets attached to the proper if.

    -- Darin

Boost list run by bdawes at, gregod at, cpdaniel at, john at