enum相当于定义一个常量,为何在iosbase中偏要在其外定义
2010-11-27 20:22
453 查看
Code:
enum _Fmtflags
{ // constants for formatting options
_Fmtmask = 0xffff, _Fmtzero = 0
};
static const _Fmtflags skipws = (_Fmtflags)_IOSskipws;
static const _Fmtflags unitbuf = (_Fmtflags)_IOSunitbuf;
static const _Fmtflags uppercase = (_Fmtflags)_IOSuppercase;
static const _Fmtflags showbase = (_Fmtflags)_IOSshowbase;
static const _Fmtflags showpoint = (_Fmtflags)_IOSshowpoint;
后面定义的都是_Fmtflags 何,要定义在外面,定义在里面不是很好吗?
enum _Fmtflags
{ // constants for formatting options
_Fmtmask = 0xffff, _Fmtzero = 0
};
static const _Fmtflags skipws = (_Fmtflags)_IOSskipws;
static const _Fmtflags unitbuf = (_Fmtflags)_IOSunitbuf;
static const _Fmtflags uppercase = (_Fmtflags)_IOSuppercase;
static const _Fmtflags showbase = (_Fmtflags)_IOSshowbase;
static const _Fmtflags showpoint = (_Fmtflags)_IOSshowpoint;
后面定义的都是_Fmtflags 何,要定义在外面,定义在里面不是很好吗?
相关文章推荐
- define \enum \const 定义一个常量
- 谈谈为何iOS开发别用宏来定义常量
- 指针与字符串:(const)char *p2 = "lmj";定义的是一个字符串常量!符串常量,正因为是常量,所以它内部的字符是不允许修改的。
- Java 常量定义-枚举enum
- 正确使用iOS常量(const)、enum以及宏(#define)
- RunLoop学习笔记,从CF层面了解由于CFRunLoopMode机制iOS程序ScrollView的滑动为何如此平滑的原因。还有介绍AFNetworking如何单独发起一个global threa
- iOS 使用可变参数va_list, 定义一个方法
- iOS define 宏定义 和 const定义常量区别
- 正确使用iOS常量(const)、enum以及宏(#define)
- iOS:枚举enum,NS_ENUM,NS_OPTIONS 定义和 位运算应用
- 为什么用const说明的常量不能用来定义一个数组的初始大小?
- iOS CALayer和3D (1): 定义一个简单的旋转3D立方体
- [Groovy]如何定义和使用一个Java里的Enum类型
- 为何在一个类中定义了带参数的构造方法的时候,需要把无参构造方法定义一下
- 我在一个类里面 定义了1000个常量或者1000个静态变量,在程序启动后,谁占的内存多
- php如何定义一个常量数组
- iOS 常量和全局变量的定义
- 正确使用iOS常量(const)、enum以及宏(#define)
- 正确使用iOS常量(const)、enum以及宏(#define)(收藏)
- iOS CALayer和3D 定义一个简单的旋转3D立方体