typeof(), __typeof(), __typeof__(), -isKindOfClass:的区别
关于 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:的区别的更多相关文章
- JavaScript中instanceof与typeof运算符的用法及区别详细解析
JavaScript中的instanceof和typeof常被用来判断一个变量是什么类型的(实例),但它们的使用还是有区别的: typeof 运算符 返回一个用来表示表达式的数据类型的字符串. typ ...
- typeof()和instanceof的用法区别
typeof() typeof() 是一个一元运算,放在一个运算数之前,运算数可以是任意类型.它返回值是一个字符串,该字符串说明运算数的类型.,typeof一般只能返回如下几个结果:number,bo ...
- isMemberOfClass和isKindOfClass的区别
1.isMemberOfClass:作用:用于判断一个对象是否属于当前这个类 Person *rose = [[Person alloc] init]; if ([rose is ...
- c# typeof 与 GetType 作用与区别
官方解释: Used to obtain the "System.Type" object for a type. A 'typeof' expression takes the ...
- [C#]typeof,Gettype()和is的区别
typeof 参数是一个类型名称,比如你自己编写的一个类 GetType()是类的方法,继承自object,返回该实例的类型 is 用来检测实例的兼容性(是否可以相互转换) 例: class Anim ...
- typeof 与 instanceof之间的区别
JS中会使用typeof 和 instanceof来判断一个变量是否为空或者是什么类型的. ES6规范中有7种数据类型,分别是基本类型和引用类型两大类 基本类型(简单类型.原始类型):String.N ...
- JavaScript中typeof和instanceof深入详解
这次主要说说javascript的类型判断函数typeof和判断构造函数原型instanceof的用法和注意的地方. typeof 先来说说typeof吧.首先需要注意的是,typeof方法返回一个字 ...
- 如何判断js中的数据类型?
js六大数据类型:number.string.object.Boolean.null.undefined string: 由单引号或双引号来说明,如"string" number: ...
- js数据类型判断和数组判断
这么基础的东西实在不应该再记录了,不过嘛,温故知新~就先从数据类型开始吧 js六大数据类型:number.string.object.Boolean.null.undefined string: 由单 ...
随机推荐
- Effective Java 第三版——55. 明智而审慎地返回Optional
Tips 书中的源代码地址:https://github.com/jbloch/effective-java-3e-source-code 注意,书中的有些代码里方法是基于Java 9 API中的,所 ...
- JAVA和JAVAC 命令行
转自:http://www.blogjava.net/pdw2009/archive/2008/06/12/207413.html?opt=admin javac和java命令行中的-classpat ...
- 物联网架构成长之路(7)-EMQ权限验证小结
1. 前言 经过前面几小节,讲了一下插件开发,这一小节主要对一些代码和目录结构进行讲解,这些都是测试过程中一些个人经验,不一定是官方做法.而且也有可能会因为版本不一致导致差异. 2. 目录结构 这个目 ...
- https://stackoverflow.com/questions/51751426/failed-to-run-the-da-platform-trial-vm
https://stackoverflow.com/questions/51751426/failed-to-run-the-da-platform-trial-vm { "annotat ...
- git 创建标签
在Git中打标签非常简单,首先,切换到需要打标签的分支上: $ git branch * dev master $ git checkout master Switched to branch 'ma ...
- js中$
$符号在php中是表示变量的特征字符, 在js中它也有很多作用, 一般我们用来命名一个函数名称,获取id的1.首先可以用来表示变量, 比如变量 var s='asdsd'或var $s='asdasd ...
- 【iCore1S 双核心板_FPGA】例程五:Signal Tapll 实验——逻辑分析仪
核心代码: //--------------------Module_Signal_TapII-------------------// module Signal_TapII( input CLK_ ...
- Serializable接口
Serializable这个接口起啥作用呢?? 这个接口没有提供任何方法,我们实现它有什么意义呢? Serializable接口是启用其序列化功能的接口.Serializable接口中没有任何方法,一 ...
- SQL group BY 合并字段用逗号隔开
1.关联多表后 根据某个字段作为分组条件,其他合并到新列中,效果如下图 --------> 代码: ),KOrderID) , , '') from VOrder2 tb group by KU ...
- jquery checkbox checked 却不显示对勾
$("input").attr("checked", true); 或 $("input").attr("checked" ...