__in 、 __out 、 __in_opt 的含义 [英] Meaning of __in , __out, __in_opt

查看:43
本文介绍了__in 、 __out 、 __in_opt 的含义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在变量之前使用的这些关键字是什么意思函数参数?

What is the meaning of these keywords used before variables in a function parameters?

  • __in
  • __out
  • __in_opt

推荐答案

这些是 Microsoft 的 SAL Annotations (较新的 现在遵循不同的大小写,以大写开头).这些对编译没有真正的影响(在 VS 2010 下它们甚至没有扩展),它们用于内联 API 文档.

Those are some of the older decoration macro's from Microsoft's SAL Annotations (the newer ones now follow different casing, starting with a capital). These have no real affect on compilation (under VS 2010 they aren't even expanded), they are there for inline API documentation.

  1. __in:此参数是函数的输入(只读,调用方已初始化).
  2. __out:这个参数包含函数返回时的输出(只写,调用者初始化).
  3. __in_opt:由_in_opt组成的复合注解,_opt表示参数是可选的,并且可以设置为默认值(一般为NULL).
  1. __in: this parameter is an input to the function (read-only, caller initialized).
  2. __out: this parameter contains output from the function when it returns (write-only, caller initialized).
  3. __in_opt: a compound annotation formed from _in and _opt, _opt indications that the parameter is optional and can be set to a default value (generally NULL).

您可以在此处获得旧装饰的完整说明 此处.

You can get the full explanation here of the older decorations here.

这篇关于__in 、 __out 、 __in_opt 的含义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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