加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c – 原子类型的大小

发布时间:2020-12-16 09:54:30 所属栏目:百科 来源:网络整理
导读:标准是否说sizeof(std :: atomic T)等于sizeof(T)? (我正在调查建立原子和其他类型的联合,以便在理想情况下不应该使用STL类型的ABI中使用.如果大小相同则可以使用). 解决方法 [atomics.types.generic] / P9 Note: The representation of an atomic speciali
标准是否说sizeof(std :: atomic< T>)等于sizeof(T)?

(我正在调查建立原子和其他类型的联合,以便在理想情况下不应该使用STL类型的ABI中使用.如果大小相同则可以使用).

解决方法

[atomics.types.generic] / P9

Note: The representation of an atomic specialization need not have the same size as its corresponding
argument type. Specializations should have the same size whenever possible,as this reduces the effort
required to port existing code

不,你不能这么认为.这是一项尽力而为的努力但无法保证.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读