关于  typeof()和 __typeof()  和 __typeof__() ,Stack Overflow 有一段解释,大概意思是,

__typeof() 、__typeof__() 是C语言的编译器特定扩展,因为标准C语言是不含这样的运算符的。标准C要求编译器用双下划线前缀扩展语言。(这也是为什么你不应该为自己的函数,变量加双下划线的原因);

typeof() 运算符也是完全相同。这三个运算符都一样,就是在编译时检查类型的。

还有一点需要注意:

-isKindOfClass: 函数是一个函数,它是在运行时检查一个对象是属于哪一个类的。而typeof()家族是一个编译期类型检查运算符,它不只能检查类,也能检查所有有效的C语言表达式;

-isKindOfClass: is a runtime check on the class of an object. The typeof() family is a compile-time check on the type (not just class) of any valid C expression.

__typeof__() and __typeof() are compiler-specific extensions to the C language, because standard C does not include such an operator. Standard C requires compilers to prefix language extensions with a double-underscore (which is also why you should never do so for your own functions, variables, etc.)

typeof() is exactly the same, but throws the underscores out the window with the understanding that every modern compiler supports it. (Actually, now that I think about it, Visual C++ might not. It does support decltype() though, which generally provides the same behaviour as typeof().)

All three mean the same thing, but none are standard C so a conforming compiler may choose to make any mean something different.

typeof(), __typeof(), __typeof__(), -isKindOfClass:的区别的更多相关文章

  1. JavaScript中instanceof与typeof运算符的用法及区别详细解析

    JavaScript中的instanceof和typeof常被用来判断一个变量是什么类型的(实例),但它们的使用还是有区别的: typeof 运算符 返回一个用来表示表达式的数据类型的字符串. typ ...

  2. typeof()和instanceof的用法区别

    typeof() typeof() 是一个一元运算,放在一个运算数之前,运算数可以是任意类型.它返回值是一个字符串,该字符串说明运算数的类型.,typeof一般只能返回如下几个结果:number,bo ...

  3. isMemberOfClass和isKindOfClass的区别

    1.isMemberOfClass:作用:用于判断一个对象是否属于当前这个类   Person *rose = [[Person alloc] init];          if ([rose is ...

  4. c# typeof 与 GetType 作用与区别

    官方解释: Used to obtain the "System.Type" object for a type. A 'typeof' expression takes the ...

  5. [C#]typeof,Gettype()和is的区别

    typeof 参数是一个类型名称,比如你自己编写的一个类 GetType()是类的方法,继承自object,返回该实例的类型 is 用来检测实例的兼容性(是否可以相互转换) 例: class Anim ...

  6. typeof 与 instanceof之间的区别

    JS中会使用typeof 和 instanceof来判断一个变量是否为空或者是什么类型的. ES6规范中有7种数据类型,分别是基本类型和引用类型两大类 基本类型(简单类型.原始类型):String.N ...

  7. JavaScript中typeof和instanceof深入详解

    这次主要说说javascript的类型判断函数typeof和判断构造函数原型instanceof的用法和注意的地方. typeof 先来说说typeof吧.首先需要注意的是,typeof方法返回一个字 ...

  8. 如何判断js中的数据类型?

    js六大数据类型:number.string.object.Boolean.null.undefined string: 由单引号或双引号来说明,如"string" number: ...

  9. js数据类型判断和数组判断

    这么基础的东西实在不应该再记录了,不过嘛,温故知新~就先从数据类型开始吧 js六大数据类型:number.string.object.Boolean.null.undefined string: 由单 ...

随机推荐

  1. shiny: Web Application Framework for R

    shiny: Web Application Framework for R 基于R语言的一个web框架,适用于数据分析与图表绘画展示类型的网站.

  2. SNF快速开发平台--规则引擎整体介绍及使用说明书

    一.设计目标 a)规则引擎语法能够满足分单,计费,WMS策略的配置要求.语法是一致和统一的 b)能够在不修改规则引擎模块的情况下,加入任意一个新的规则:实现上述需求之外的规则配置需求 c)运算速度快 ...

  3. intellij idea (Android studio )外部程序 打开某扩展名(格式)

    最近在为项目开发写思维导图, 为了留下思考的过程和业务逻辑. 本人使用的工具是很可怜的freemind,所以“脑图”的扩展名是“.mm” 情景: 在intellij idea (Android stu ...

  4. [MySQL]对于事务并发处理带来的问题,脏读、不可重复读、幻读的理解

    一.缘由 众所周知MySQL从5.5.8开始,Innodb就是默认的存储引擎,Innodb最大的特点是:支持事务.支持行级锁. 既然支持事务,那么就会有处理并发事务带来的问题:更新丢失.脏读.不可重复 ...

  5. js实现cookie跨域功能

    /** * 设置cookie方法 * @param {string} name cookie键值 * @return {*} 返回cookie值 */ function setCookie_log(c ...

  6. 【WPF】自定义形状的按钮Button

    需求:做一个如下图所示的多边形按钮. <!-- 特殊形状的按钮 --> <Grid> <Polygon Points="0,0 140,0 190,42 140 ...

  7. ODbgScript 2.01帮助文档

    -------------------------------ODbgScript original pluginhttp://github.com/odbgscript--------------- ...

  8. Java知多少(51)finally

    当异常被抛出,通常方法的执行将作一个陡峭的非线性的转向.依赖于方法是怎样编码的,异常甚至可以导致方法过早返回.这在一些方法中是一个问题.例如,如果一个方法打开一个文件项并关闭,然后退出,你不希望关闭文 ...

  9. vector、map 内存释放

    一.vector void TestVector() { cout << "begin create vector" << endl; int iSize ...

  10. HAVANA 团队简介

    在Ensembl 下载的gtf 文件中,会有一部分来源自 HAVANA havana 的全称叫做 human  and vertebrate analysis and annotation, 是sag ...