Boost logo

Boost Users :

From: David Abrahams (dave_at_[hidden])
Date: 2008-06-20 11:20:41

Robert Ramey wrote:
> check the rationale section regarding the saving of non-const data sets.
> Robert Ramey
> Daniel Hinz wrote:
>> Just started experimenting with the serialization library. I started
>> by writing a small example very much like that shown in the tutorial.
>> I created a simple class to serialize containing two unsigned int
>> vars and an std::string This is close to what I would need to do once
>> I move beyond familiarizing myself with the use of the library.
>> When I compile I get errors in the boost code:
>> s-test.h:49: instantiated from here
>> /usr/include/boost/archive/detail/oserializer.hpp:567: error: invalid
>> application of 'sizeof' to incomplete
>> type 'boost::STATIC_ASSERTION_FAILURE<false>'
>> make: *** [stest] Error 1
>> When I look at boost static assert I find this:
>> #define BOOST_STATIC_ASSERT( B ) \
>> typedef ::boost::static_assert_test<\
>> sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( B ) >)>\
>> BOOST_JOIN(boost_static_assert_typedef_, __LINE__)
>> #endif
>> Which I believe is macro expansion sizeof that is being complained
>> about.


What Robert failed to mention is that the whole **purpose** of
BOOST_STATIC_ASSERT is to cause a compilation error using sizeof when
some condition is violated.

I sure wish people would stop using BOOST_STATIC_ASSERT in favor of one
of the MPL_ASSERT macros, because the error messages are so much better
and would lead to less confusion and easier support.

Dave Abrahams
BoostPro Computing

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at