Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
928 views
in Technique[技术] by (71.8m points)

visual c++ - Meaning of __in , __out, __in_opt

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

  • __in
  • __out
  • __in_opt
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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: 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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...