vitek@apache.org wrote:
> Author: vitek
> Date: Thu Jun 19 15:52:34 2008
> New Revision: 669735
>
> URL: http://svn.apache.org/viewvc?rev=669735&view=rev
> Log:
> 2008-06-19 Travis Vitek <vitek@roguewave.com>
>
> STDCXX-926
[...]
> Modified: stdcxx/branches/4.3.x/include/rw/_meta_other.h
> URL: http://svn.apache.org/viewvc/stdcxx/branches/4.3.x/include/rw/_meta_other.h?rev=669735&r1=669734&r2=669735&view=diff
> ==============================================================================
> --- stdcxx/branches/4.3.x/include/rw/_meta_other.h (original)
> +++ stdcxx/branches/4.3.x/include/rw/_meta_other.h Thu Jun 19 15:52:34 2008
> @@ -37,50 +37,318 @@
[...]
> +template <size_t _Size, size_t _Align = __rw_default_alignment<_Size>::value>
> struct __rw_aligned_storage
> {
> + _RWSTD_STATIC_ASSERT (_Size != 0,
> + "Unsupported size");
> +
> + _RWSTD_STATIC_ASSERT ((_Align & (_Align - 1)) == 0 || _Align == 0,
> + "Unsupported alignment"); // expect power of 2
> +
> + _RWSTD_STATIC_ASSERT (_Align <= _RWSTD_TT_MAX_ALIGNMENT,
> + "Unsupported alignment"); // expect less than max
> +
> typedef union {
> - unsigned char __data [_Len];
> - // not implemented
> + unsigned char __size [_Size];
> +
> + typename
> + __rw_aligned_storage_impl<_Align>::_C_type __align;
I believe there are platforms where unions are aligned on
the boundary given by the first member. This one looks like
it might be one of them: http://tinyurl.com/472744. Unless
I'm mistaken we should switch the order of the two members
to make sure the union is properly aligned.
Also, strictly speaking, names of data members should have
the _C_ prefix (double underscores are used for locals and
function parameters).
Martin
|