On Wed, Mar 4, 2009 at 6:14 AM, Piotr Wyderski <piotr.wyder...@gmail.com> wrote:
> Hello,
>
> Is it possible to allow C++ constant expressions (currently static const,
> and C++0x constexpr in the future) to be used as __attribute__ parameters
> in the upcomming version of GCC? In my code I have the following construction:
>
>    namespace simd {
>
>       static const std::size_t vector_size = 16U;
>    };
>
> but cannot use it in order to declare a variable like this:
>
>   std::uint8_t v[128] __attribute__((__aligned__(simd::vector_size)));
>
> because GCC (4.4.0 snapshot from the end of January, x86/Cygwin)
> complains that:
>
>    error: expected ')' before '::' token
>
> rewritten to:
>
>    static const std::size_t len = 16;
>    std::uint8_t v[128] __attribute__((__aligned__(len)));
>
> results in:
>
>    error: requested alignment is not a constant
>
> One needs to introduce a preprocessor macro SIMD_VECTOR_SIZE
> just in order to fix this particular issue.

You can use __BIGGEST_ALIGNMENT__ for that purpose.

-- 
H.J.

Reply via email to