|
struct T //C++, C11
{
int m;
union //anonymous
{
char * index;
int key;
};
};
struct T t;
t.key=1300; //access the union's member directly
//C11 only
#define cbrt(X) _Generic((X), long double: cbrtl,
default: cbrt,
float: cbrtf)(X)
其原理,编译器根据参数X的类型来进行相应的替换.
void *aligned_alloc(size_t algn, size_t size);
这个函数以algn的对齐分配size大小的内存,返回所分配内存的指针.
C11中新的对齐相关功能于新的头文件<stdalign.h>中定义.