lundi 18 avril 2016

How to check a constant variable using #if directives compile time in Visual Studio?

The following code does not work as I expect using Visual Studio 2015, so it do not give a compile time error "ALIGN_SIZE must be divisible by 32". Is it possible to do something like this in compile time?

const static size_t ALIGN_SIZE = 65;
#if ALIGN_SIZE % 32 > 0
   #error ALIGN_SIZE must be divisible by 32
#endif

Aucun commentaire:

Enregistrer un commentaire