Let's say I have the following function:
unsigned char *f(unsigned char*, int, int, long, const char*);
I could change the return value to HRESULT
(or my own defined), but I have to change the entire code inside a function. Or I could simly use throw
to point out the error.
My questions are:
- What advantages/disadvantages are of returning
HRESULT
? - What advantages/disadvantages are with
throw
? - And which one is the more safer way?
Should I use the second one or it completly depends on what I prefer?
EDIT: I didn't strictly mean using HRESULT
. You can define your own enum for error-handling to be independent of Windows