跨平台属性对齐
attribute aligned crossplatform
是GCC的
union uint128_t {
uint64_t q[2];
uint64_t w[8];
char b[16];
} __attribute__((aligned (16)));
与(跨平台(相同:
union alignas(16) uint128_t {
uint64_t q[2];
uint64_t w[8];
char b[16];
};
?
是的。 请参阅__attribute__((aligned))
和alignas
。
如果你问"为什么<某些图书馆>使用__attribute__
而不是alignas
? 我怀疑答案是"因为alignas
相对较新,但__attribute__
支持的时间要长得多。某些图书馆>
相关文章:
- 如何理解将半精度指针转换为无符号长指针和相关的内存对齐
- 如何创建一个QTableWidgetItem,用长文本右对齐,左边有省略号
- 我可以检测和更改 gcc/g++ 中结构的当前数据对齐设置吗?
- 64位机器上的C++内存对齐
- 为什么我可以将变量存储在不是其最小对齐方式的倍数的地址?
- 使 std::vector 分配对齐内存的现代方法
- C++ cout 将双精度对齐到精度 2 并正确对齐
- 在 64 位边界上对齐C++结构数组?
- 使用 g++7 构建的代码在访问未对齐的内存时崩溃
- 在 capnp FlatArrayMessageReader 的对齐内存缓冲区中接收 zmq 消息
- 是否值得对齐变量?
- 初始化派生结构的基部分/意外打包派生结构字段以对齐基结构的间隙
- 对齐和对齐的实际用例C++关键字
- 如何减少代码的运行时间以对齐文本?
- 指向包含对齐 C 结构C++类的 C 指针的对齐问题
- gcc 中的多个对齐属性是否可以用于保证缓存行分隔?
- 将 C++ 类属性与分号前面的最后一个单词对齐;在 emacs 中
- 跨平台属性对齐
- C++数组的对齐未对齐属性
- GCC/Clang中内存对齐的通用属性