What is the quot;interfacequot; keyword in MSVC?(什么是“接口?MSVC 中的关键字?)
问题描述
我正在查看 Windows 8.1 SDK,在 UnknownBase.h 中看到类似
I'm looking through the Windows 8.1 SDK and in UnknownBase.h I'm seeing things like
typedef interface IUnknown IUnknown;
我以前从未见过这个 interface 关键字.请注意,这绝对是一个 .h 标头,由 cl.exe 处理.不是IDL文件,也不是midl.exe处理的.
I've never seen this interface keyword before. Note that this is very definitely a .h header, processed by cl.exe. It's not IDL file, and it's not processed by midl.exe.
我在网上找到了这个:http://msdn.microsoft.com/en-us/library/50h7kwtb.aspx
但是__interface和interface
有人能帮我介绍一下吗?
Can anyone clue me in here?
推荐答案
Microsoft 有一些特定于编译器的扩展,例如您链接的扩展,但 interface 不应该是本地 C++ 编译器特定的关键字,而是而是一个替代某些东西的定义(在 BaseTyps.h 中它曾经定义如下)
Microsoft has some compiler-specific extensions like the one you linked but interface shouldn't be a native C++ compiler-specific keyword but rather a define which substitutes something (in BaseTyps.h it used to be defined as follows)
# define interface struct
链接在这里
如果您想验证这一点,请为此类定义执行 grep,您应该会找到类似的内容.
If you want to verify this do a grep for such a definition and you should find something similar.
参考:http://social.msdn.microsoft.com/forums/vstudio/en-US/06bf1dea-1d20-4ec3-b9a1-3d673d7fcd8d/what-is-the-interface-keyword-in-native-c
这篇关于什么是“接口"?MSVC 中的关键字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:什么是“接口"?MSVC 中的关键字?
基础教程推荐
- 为什么派生模板类不能访问基模板类的标识符? 2021-01-01
- GDB 显示调用堆栈上函数地址的当前编译二进制文 2022-09-05
- 为什么 typeid.name() 使用 GCC 返回奇怪的字符以及如 2022-09-16
- 如果我为无符号变量分配负值会发生什么? 2022-01-01
- 我应该对 C++ 中的成员变量和函数参数使用相同的名称吗? 2021-01-01
- 非静态 const 成员,不能使用默认赋值运算符 2022-10-09
- 初始化列表*参数*评估顺序 2021-01-01
- 为什么 RegOpenKeyEx() 在 Vista 64 位上返回错误代码 2021-01-01
- 通过引用传递 C++ 迭代器有什么问题? 2022-01-01
- CString 到 char* 2021-01-01
