关键字 __typeof__
来源:互联网 发布:淘宝服饰店铺简介 编辑:程序博客网 时间:2024/05/18 02:47
__typeof__(var) 是gcc对C语言的一个扩展保留字,用于声明变量类型,var可以是数据类型(int, char*..),也可以是变量表达式。
define DEFINE_MY_TYPE(type, name) __thread __typeof__(type) my_var_##name
DEFINE_MY_TYPE(int, one); //It is equivalent to '__thread int my_var_'; which is a thread variable.
int main()
{
__typeof__(int *) x; //It is equivalent to 'int *x';
__typeof__(int) a;//It is equivalent to 'int a';
__typeof__(*x) y;//It is equivalent to 'int y';
__typeof__(&a) b;//It is equivalent to 'int b';
__typeof__(__typeof__(int *)[4]) z; //It is equivalent to 'int *z[4]';
y = *x;
b = &a;
z[0] = x;
z[1] = &a;
return 0;
}
1 0
- 关键字 __typeof__
- __thread 和 __typeof__关键字
- __thread 和 __typeof__关键字
- __thread 和 __typeof__关键字
- __thread 和 __typeof__关键字
- __thread 和 __typeof__关键字
- __typeof__
- GCC __typeof__ __extension__
- typeof(),__typeof__(),__typeof()
- __typeof__ / __attribute__((__section__ / __attrubte__ ((packed))
- __thread, __typeof__与逗号表达式
- __thread, __typeof__与逗号表达式
- 关键字
- 关键字
- 关键字
- 关键字
- 关键字
- 关键字
- 正则表达式,匹配文件名类型
- 连续数打乱,判断出少了哪些数字
- NSThread简介
- iOS开发UI篇—CALayer简介
- SQL 中order by 、group by 、having的用法区别
- 关键字 __typeof__
- LeetCode(107) Binary Tree Level Order Traversal II
- UIButton的UIEdgeInsets功能:设置button上的文字和图片的位置
- Android动画总结之View动画
- C基础:布尔类型(BOOL) 关系运算符 switch
- 在android中读取联系人信息的程序,包括读取联系人姓名、联系方式和邮箱等
- Javascript获取select下拉框选中的的值
- 第三次修改记录
- mongoDB基本操作