Visual Studio supports C++11's alignas since version 2015. Though, in much samples from Microsoft, I still notice the use of "_declspec(align(16))". I guess the reason is for backwards compatibility with Visual Studio 2013. C++17 extends the alignas behavior by also ensuring the right alignment for dynamic memory allocation. Before C++17, one would have to override the operators new, new[], delete, delete[] for the right alignment of dynamically allocated memory. So is there still some non-mentioned benefit in preferring _declspec(align(16)) over alignas(16)? Note that with alignas it is still possible to override the operators new, new[], delete, delete[].
↧