Boost logo

Boost :

From: Christoph Ludwig (cludwig_at_[hidden])
Date: 2004-10-05 06:15:13


I tried to become acquainted with Boost.Python. But even the examples
in the documentation won't compile. The examples leave the impression
as if they are untested because they contain quite obvious

For instance, from libs/python/doc/v2/operators.html (current CVS):

  struct number
     : boost::integer_arithmetic<number>
     number(long x_) : x(x_) {}
     operator long() const { return x; }
     number& operator+=(number const& rhs)
        { x += rhs }
     number& operator-=(number const& rhs);
        { x -= rhs }
     number& operator*=(number const& rhs)
        { x *= rhs }
     number& operator/=(number const& rhs);
        { x /= rhs }
     number& operator%=(number const& rhs);
        { x %= rhs }
     long x;

There are spurious semicolons after the argument list of operators -=,
/=, and %=. On the other hand, there are semicolons missing in the
bodies of the in-place operators...

OK, it was no problem to fix this. But if run on the complete
operators example, the compiler (gcc 3.4.2 on 686-pc-linux-gnu) chokes
nevertheless. And this time I can't make much sense out of the error
messages. (In case someone is interested, the compiler output is
online at <URL:>.)

The regression test table at
<URL:> shows
a runtime failure of the operators test for gcc 3.4.2. So the
corresponding C++ module could be compiled, in contrast to the example
from the docs. The user-level report at the meta-comm site
<URL:> (last updated on Aug 11) shows that the
operators test passed with gcc 3.4.1.

Since the regression tests show some problems with gcc 3.4.2, I can't
be completey sure whether the errors I see are due to a compiler /
platform problem or to a erroneous example. Since the example
contained errors that had nothing to do with Boost.Python and the
compiler and since examples from the tutorial also failed I suspect
the latter.

Can someone explain how this particular example needs to be changed
so it can be compiled? Will the examples in the docs be checked
before the upcoming release?




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