Reputation: 21201
If in Visual Studio I specify alignment for a class or structure, e.g.
struct __declspec(align(256)) A
{
};
I get level 4 warning as follows ‘warning C4324: 'A': structure was padded due to alignment specifier’. Do I specify alignment somehow incorrectly or this warning is just safe to ignore?
Upvotes: 1
Views: 1476
Reputation: 238351
Do I specify alignment somehow incorrectly
No, although you are using a language extension. That may be unnecessary as there is a standard syntax that would be preferable:
struct alignas(256) A
{
};
This warning is just safe to ignore?
Yes, it is safe to ignore this warning, unless you have areason to consider the padding to be a problem.
However, I recommend asking yourself: why would you need a class to be aligned when it has no members?
Upvotes: 3