switch的cae不支持string 只支持常量 整型、字符、枚举

来源:互联网 发布:mysql and not 编辑:程序博客网 时间:2024/06/05 10:54
 

◇   数据类型分类
·   基本数据类型

                            固定长度型-bool,   char(__int8),   short(__int16),   long(__int32),   __int64
    整型存储型{
{                         不定长度型-int,   enum
    浮点存储型-float,   double


·   衍生数据类型
      byte       -unsigned   char
      boolean-unsigned   char
      Boolean-short
      wchar_t-unsigned   short
      size_t   -unsigned   int   或   unsigned   __int64
      hyper     -__int64   或   double

      注:※   有一些可能是VC7(.net)新增的,VC6没有
              ※   byte   是为了与其它语言/编译器兼容
              ※   bool   是   VC   特有的,取值为   true(1)/false(0)。boolean/Boolean   是为了与其它
                    语言/编译器兼容,取值为   True(-1)/false(0)。
              ※   wchar_t   表示宽字符。

 

switch-case   只支持这些类型。其它如字串、点、矩形等都只能叫作“类数据类型”或
“准数据类型”,实际上是   array,   struct   或   class,这些不便于直接比较,switch-case   不支持。

原帖地址:http://blog.sina.com.cn/s/blog_66871b8d0100t3yz.html

原创粉丝点击