Boost logo

Boost Users :

Subject: [Boost-users] serialization: BOOST_STATIC_WARNING
From: Travis Gockel (travis_at_[hidden])
Date: 2011-05-25 13:09:22


I've recently had some trouble with C++'s implicit casting, so I'm looking
for a way to warn people if somebody attempts to assign an int32_t to a
uint64_t or whatever. BOOST_STATIC_ASSERT would work wonders for this,
except that the code base I'm working with is quite large and relies on a
lot of implicit casting, so immediately breaking everything with assertions
is unrealistic.

It looks like BOOST_STATIC_WARNING (
http://www.boost.org/doc/libs/1_46_1/libs/serialization/doc/static_warning.html)
would be ideal for me, however, I cannot get it to actually emit a warning.
 I have attached a quick example of what I am looking for, but it
essentially boils down to this not doing anything:

        typedef boost::is_same<int64_t, int32_t> same_type;
        BOOST_STATIC_WARNING(same_type::value);

My compiler is g++ 4.4.3 with --std=c++0x -Wall -Wextra.

Thanks!

-- 
- Travis Gockel




Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net