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 中的关键字?
基础教程推荐
- 如何部分禁用 cmake C/C++ 自定义编译器检查 2021-01-01
- 为什么我们不能使用“虚拟继承"?在 COM 中? 2022-01-01
- 如何更改 SysDateTimePick32 或 CDateTimeCtrl 的背景颜色? 2022-01-01
- 随机插入/删除的综合向量与链表基准 2022-01-01
- C++:获取传递给函数的多维数组的行大小 2021-01-01
- c++ STL设置差异 2022-01-01
- 如何在 C++ 中正确使用命名空间? 2022-01-01
- 将不可复制的闭包对象传递给 std::function 参数 2021-01-01
- 提升 ASIO 流缓冲 2021-01-01
- 与 CAS 的原子交换(使用 gcc 同步内置函数) 2022-01-01
