__declspec(align) for multiple declarations

2019-07-04 07:39发布

问题:

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:

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