关于  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. connect by prior start with 语句实现树递归查询[百度经验]

    TART WITH CONNECT BY PRIOR子句实现递归查询 TART WITH CONNECT BY PRIOR这个语法主要用于查询数据包中的树型结构关系.先看下原始数据时怎么样的吧! 表中 ...

  2. Docker 管理应用程序数据

    1.将Docker主机数据挂载到容器 Docker提供三种不同的方式将数据从宿主机挂载到容器中:volumes , bind mounts 和tmpfs volumes:  Docker管理宿主机文件 ...

  3. latex学习(二)

    1.我是在ubuntu18.04下安装的,使用的是清华的源:https://mirrors.tuna.tsinghua.edu.cn/help/CTAN/ 下载安装包:http://mirror.ct ...

  4. C#中的Action<>和Func<>

    其实他们两个都是委托[代理]的简写形式. 一.[action<>]指定那些只有输入参数,没有返回值的委托 Delegate的代码: public delegate void myDeleg ...

  5. linux(mac) 编译安装MySQL

    Reference: https://blog.csdn.net/Tzhennan/article/details/80565235 官方下载地址:  https://dev.mysql.com/do ...

  6. [转]《RabbitMQ官方指南》安装指南

    原文链接   翻译:xiezc 目录(其中的文章后续翻译): Windows下安装 Debian / Ubuntu下安装 基于RPM的Linux下安装 Mac OS X下安装 Homebrew安装 W ...

  7. Centos7.x 执行top命令教程

    一.作用 top命令用来显示执行中的进程,使用权限是所有用户 二.格式 top [-] [d delay] [q] [c] [S] [s] [i] [n] 三.命令参数解释 d:指定更新的间隔,以秒计 ...

  8. Go语言实践_实现一(客户端)对一(服务器端)聊天室

    一.目的 使用Go语言实现一个服务器端与客户端的聊天室. 软件:Goland,Go1.9 代码仓库地址 二.思路 1,首先启动服务器端,使用listen_socket函数监听IP地址上的客户端连接: ...

  9. 配置 -- php运行报Call to undefined function curl_init()的解决办法

    很早之前就出现过这个问题,网上百度了下,答案千篇一律,都是说: 1.在php.ini中开启curl扩展 2.将php目录下的libeay32.dll.ssleay32.dll.php5ts.dll拷贝 ...

  10. 解决Django-1.8.2应用部署到Apache后无法显示admin应用的CSS

    在将Django-1.8.2应用部署到Apache后,无法显示admin应用的静态内容,而在“manage.py runserver”命令下可以正常显示,主要是Apache没有找到Django静态内容 ...