什么是“接口"?MSVC 中的关键字? [英] What is the "interface" keyword in MSVC?

查看:29
本文介绍了什么是“接口"?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

但是__interfaceinterface

有人能帮我介绍一下吗?

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 中的关键字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆