aligning extern constants (gcc)

Posted by ~buratinas on Stack Overflow See other posts from Stack Overflow or by ~buratinas
Published on 2010-04-25T12:07:03Z Indexed on 2010/04/25 12:13 UTC
Read the original article Hit count: 135

Filed under:
|
|

I want to make some static constants globally visible. I'm pretty familiar how to do that in C++. The problem is that these constants need to be aligned to some exotic boundary. Do I have to specify the alignment in extern declaration? I'm using GCC4.5

in *.cpp file

static const constant_t constant __attribute__((aligned(64))) = {blah,blah,blah};

in *.h file

//Which one is correct?
extern const constant_t constant;
extern const constant_t constant __attribute__((aligned(64)));

© Stack Overflow or respective owner

Related posts about c++

Related posts about alignment