3 ms·
Returning an error is fine, but the code that calls the function doesn't check for errors, and just blindly applies the return value as an offset to a pointer.
by mikeash 11y ago
Returning an error is fine, but the code that calls the function doesn't check for errors, and just blindly applies the return value as an offset to a pointer. When the function returns -ERANGE to indicate that the value was too large for the requested data type, entertaining things will occur.