Boost logo

Boost :

From: Gennaro Prota (gennaro_prota_at_[hidden])
Date: 2006-08-26 13:55:15


On Sat, 26 Aug 2006 14:00:13 +0200, Stephan Tolksdorf
<andorxor_at_[hidden]> wrote:

>Hi,
>
>BOOST_CHECK_EQUAL is implemented in a way that checking static const
>integral members yields "undefined reference" errors in GCC. For example
>
>--
>#define BOOST_TEST_MAIN
>#include "boost/test/included/unit_test.hpp"
>
>struct Test {
> static const int n = 1;
>};
>
>BOOST_AUTO_TEST_SUITE(TestSuite);
>BOOST_AUTO_TEST_CASE(TestCase) {
> BOOST_CHECK_EQUAL(1,Test::n);
>}
>BOOST_AUTO_TEST_SUITE_END();

One could "fix" BOOST_CHECK_EQUAL, but the problem remains that such
static const definitions easily lead to undefined behavior in the
current language. If you want I can send you the solution I use in my
own code, but I only release it under the GPL.

--
[ Gennaro Prota. C++ developer, Library designer. ]
[    For Hire    http://gennaro-prota.50webs.com/ ]

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