What is the difference between the WINAPI SetLastError() and the C++ keyword throw? For example, are SetLastError(5); and throw 5; the same?
What is the difference between the WINAPI SetLastError() and the C++ keyword throw ?
Share
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.
SetLastError sets a simple global variable, it does nothing to the flow of the program.
throw would stop the flow of the running program, unwind the stack until it is caught somewhere with a try – catch clause. The program flow would then continue from the end of the catch.
I suggest reading this article, which explains the concept of exceptions. And read up on C++ exceptions.