dimanche 22 avril 2018

Can the pointer in C++ (windows VC++ compiler) be aligned with __declspec?

In Linux (gcc) I can align a structure by

#ifndef WIN32
    #define ALIGN(size) __attribute__((aligned(size)))
#else
    #define ALIGN(size) __declspec(align(size))
#endif
struct Test {
    float buffer[12];
};
Test ALIGN(16) test;

The pointer alignment maybe defined as

#ifndef WIN32
    #define ALIGN_PTR(size) __attribute__((align_value(size)))
#endif
Test * ALIGN_PTR(16) pTest;

Question:

What is equivalent __attribute__((align_value(size))) in windows VC++ compiler?

Aucun commentaire:

Enregistrer un commentaire