What do “_in_” and “_in_opt_” mean in C++/CLI


I'm fairly new to CLR, I'm reading the c++/CLI documentation for setWindowPos and the function is defined like so.

  _In_      HWND hWnd,
  _In_opt_  HWND hWndInsertAfter,
  _In_      int X,
  _In_      int Y,
  _In_      int cx,
  _In_      int cy,
  _In_      UINT uFlags

I have experience in c++ so I understand that, for example, "HWND" is the data type and "hWnd" is the variable name.

But what are "_in_" and "_in_opt_"?

I'm guessing they're short for "input variables" or something.

It is mentioned in the documentation that the hWndInsertAfter is optional. Does this mean I can simply omit/not bother passing a variable to to this parameter in my function call if I don't need to?


//Note that we're one parameter short here (the second is missing)

(This would be confusing to me, as I've seen it written in other places that C++ does not support optional parameters. Only default parameters and overloading)

Best Solution

This is part of Microsoft's Source-Code Annotation Language. _In_Opt_ means you may pass NULL.

Related Question