Boost logo

Boost :

From: Douglas Paul Gregor (gregod_at_[hidden])
Date: 2003-12-03 14:51:13

On Wed, 3 Dec 2003, David Abrahams wrote:
> Douglas Paul Gregor <gregod_at_[hidden]> writes:
> > type_with_alignment is supposed to give back a POD type. When we create
> > other types in type_with_alignment that may be returned (say, the aligned
> > structs for the GCC-specific version), we should be marking them POD via
> > BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,...,true).
> Obviously you didn't include all the possible numbers:
> BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::detail::max_align,true)
> BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::detail::lower_alignment<1> ,true)
> BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::detail::lower_alignment<2> ,true)
> BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::detail::lower_alignment<4> ,true)
> BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::detail::lower_alignment<8> ,true)
> BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::detail::lower_alignment<10> ,true)
> BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::detail::lower_alignment<16> ,true)
> BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::detail::lower_alignment<32> ,true)

Hmmm, that's not right. The user never gets lower_alignment<N> back, they
get lower_alignment<N>::type. But we can't do that, because those could be
built-in types.

The right way is probably to do a
BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,T,true) for all T's in
BOOST_TT_ALIGNMENT_STRUCT_TYPES. I can't fix this now, but should get a
chance later, when I some compiler other than GCC hanging around.

> Why not just use a partial specialization where it's available?

Yeah, we can do that, too, by specializing is_pod on has_one_T<T>.

> > I did this for GCC (so I find it odd it's broken there)
> It's only broken with gcc-2.95.x and maybe only on Cygwin.

It's fine on GCC 2.95.3 under Linux (according to the regression tests, at
least), and it doesn't make sense that the change you made would have
fixed any GCC: GCC won't ever pick one of the has_one_T structures unless
you've found a really screwy alignment (i.e., not 1, 2, 4, 8, 16, or 32).
Perhaps alignment_of is broken in Cygwin, so it's giving some nonsense


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