: Why does the Windows API use the SetLastError/GetLastError model
: instead of just having functions return success or an error code? Is
: there any reason someone writing their own API for Win32 should use
: the Get/Set LastError model instead of just returning sucess or
: error code? Thanks.
The Win API is designed to return a TRUE/FALSE code as a signal of success or failure. A lot of APIs return a handle or pointer, which can be NULL or non-NULL value. This also translates to a success or failure return code.
The ability to give the real reason of success or failure is very good for extending the API in next versions of Win API.