Why do we need attributes?
In this part we learn about attributes!
We'll cover the following...
Let’s start with an example
Have you ever used __declspec, __attribute
or #pragma
directives in your code?
Here is an example:
Press + to interact
// set an alignmentstruct S { short f[3]; } __attribute__ ((aligned (8)));// this function won't returnvoid fatal () __attribute__ ((noreturn));
Or for DLL import/export in MSVC:
Press + to interact
#if COMPILING_DLL#define DLLEXPORT __declspec(dllexport)#else#define DLLEXPORT __declspec(dllimport)#endif
Those are existing ...