c语言中 015 代表什么,C类型的15种分类是什么?

在由Walter E. Brown发表的

CppCon2014 conference talk期间,他指出标准描述的C中有15种类型的类型。

“C类型宇宙的15个分区”。

“void是其中之一。 – Walter E. Brown。

什么是其他14?

在探索标准时,我发现了以下内容:

// 20.11.4.1

primary type categories:

template struct is_void;

template struct is_integral;

template struct is_floating_point;

template struct is_array;

template struct is_pointer;

template struct is_lvalue_reference;

template struct is_rvalue_reference;

template struct is_member_object_pointer;

template struct is_member_function_pointer;

template struct is_enum;

template struct is_union;

template struct is_class;

template struct is_function;

// 20.11.4.2

composite type categories:

template struct is_reference;

template struct is_arithmetic;

template struct is_fundamental;

template struct is_object;

template struct is_scalar;

template struct is_compound;

template struct is_member_pointer;

嗯,这是超过15.这些都是类型特征无论如何。它们用于在编译时测试类型的某些属性。例如,整数类型将返回is_integral,is_fundamental的值,为is_scalar。也许15是上面列出的一些,其余的是其他人的子类别。

这里是我试图做一个语言的类型树的尝试:

我猜:

1. void

2. bool

3. char

4. nullptr

5. integral (signed)

6. integral (unsigned)

7. floating

8. enum

9. array

10. class

11. union

12. lvalue reference

13. rvalue reference

14. member object pointer

15. member function pointer

但还要注意,bool,char和enum都是整数类型,所以我对这个列表真的不太有信心。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值