Can I set an int to NaN? If yes, then how can I check if an int is NaN or not?
Can I set an int to NaN? If yes, then how can I check if an int is NaN or not?
I think the most proper API to handle failures is to return a second integer error code in your api like:
int myfunc(args, int* realReturn);
The returned int is an error code.
The previous output is passed as a pointer in calling code:
int myInt;
if (myFunc(args, &myInt) != 0) {
//handle error
}