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 中的关键字?
- 如何对自定义类的向量使用std::find()? 2022-11-07
- 使用/clr 时出现 LNK2022 错误 2022-01-01
- C++ 协变模板 2021-01-01
- 从python回调到c++的选项 2022-11-16
- Stroustrup 的 Simple_window.h 2022-01-01
- 静态初始化顺序失败 2022-01-01
- 与 int by int 相比,为什么执行 float by float 矩阵乘法更快? 2021-01-01
- 一起使用 MPI 和 OpenCV 时出现分段错误 2022-01-01
- 近似搜索的工作原理 2021-01-01
- STL 中有 dereference_iterator 吗? 2022-01-01
