c++ - How can we Let VC++ to automatically determine the best alignment size using __declspec? -


in gcc can can leave out alignment factor , ask compiler align type maximum useful alignment target machine compiling for:

    struct s {        short f[3];      } __attribute__ ((aligned)); 

how can same visual studio c++ compiler using __declspec?? can done explicitly provide alignment size such as:

__declspec(align(#)) // # alignment size in bytes 

and msdn says:

without __declspec(align(#)), visual c++ aligns data on natural boundaries based on target processor , size of data, 4-byte boundaries on 32-bit processors, , 8-byte boundaries on 64-bit processors. data in classes or structures aligned in class or structure @ minimum of natural alignment , current packing setting (from #pragma pack or /zp compiler option).

dose means maximum useful alignment natural boundaries in case?


Comments

Popular posts from this blog

inversion of control - Autofac named registration constructor injection -

verilog - Systemverilog dynamic casting issues -

ios - Change Storyboard View using Seague -