Quantcast
Channel: GameDev.net
Viewing all articles
Browse latest Browse all 17825

_declspec(align(16)) vs alignas(16)

$
0
0
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[].

Viewing all articles
Browse latest Browse all 17825

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>