为什么typedef不能用于静态? [英] Why typedef can not be used with static?
本文介绍了为什么typedef不能用于静态?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
为什么typedef不能用于静态?例如,下面的代码是一个错误
typedef static int INT2;
使用typedef还应遵循什么其他规则?什么其他关键字不能与typedef一起使用?
感谢这么多!
解决方案
typedef不声明
>是您应用于实例而不是类型的限定符,因此您可以在使用类型时使用static,但在定义类型时不能使用static。喜欢这个.. typedef int int32;
static int32 foo;
Why typedef can not be used with static? For example, the code below is an error
typedef static int INT2;
What other rules should be follow to use the typedef? What other keywords can not be used with typedef?
Thanks so much!
解决方案
typedef doesn't declare an instance of a variable, it declares a type (type alias actually),
static
is a qualifier you apply to an instance, not a type, so you can use static when you use the type, but not when you define the type. Like this..
typedef int int32;
static int32 foo;
这篇关于为什么typedef不能用于静态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文