If a HANDLE is an output parameter, is it necessary to use a reference to the HANDLE or use HANDLE directly?
bool fn(HANDLE h_result);
or
bool fn(HANDLE& h_result);
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
To return values you can:
returnWhen you specify the following:
You are making a copy of h_result. So if you change it in your function, you are changing the copy, not the original.
When dealing with pointers, the concept is exactly the same. Just remember that a pointer is simply a variable that holds a memory address. It doesn’t matter what’s in that memory address. If you want to return a memory address via a parameter, then you need to use a pointer to a pointer or a pointer reference.