Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What do "_in_" and "_in_opt_" mean in C++/CLI?

Tags:

c++-cli

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

BOOL WINAPI SetWindowPos(
  _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?

e.g.

SetWindowPos(this,0,0,GetSystemMetrics(SM_CXMAXIMIZED),GetSystemMetrics(SM_CYMAXIMIZED),SWP_NOZORDER);
//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)

like image 449
Guy Joel McLean Avatar asked May 28 '13 17:05

Guy Joel McLean


1 Answers

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

like image 163
mwerschy Avatar answered Nov 12 '22 18:11

mwerschy