__declspec(align) for multiple declarations

2019-07-04 07:10发布

Sorry for the very simple question, couldn't find a googleable answer.

Is this declaration syntax:

__declspec(align(16)) float rF[4];
__declspec(align(16)) float gF[4];
__declspec(align(16)) float bF[4];

Equivalent to this:

__declspec(align(16)) float rF[4], gF[4], bF[4];

Or will only the first variable be aligned in the latter syntax?

If it matters, these are local variables inside a global method.

1条回答
迷人小祖宗
2楼-- · 2019-07-04 07:48

Yes. A __declspec is part of the storage class and applies to all declarators in the declaration.

查看更多
登录 后发表回答