3 ms·
If exceptions aren't used, the error case has to be handled somehow. The usual approach is to return two results, and callers have to check the error flag some
by not2b 7y ago
If exceptions aren't used, the error case has to be handled somehow. The usual approach is to return two results, and callers have to check the error flag somehow. If exceptions are very rarely thrown, then even with their very high overhead the total cost could well be lower than the cost of returning a separate error result and having callers check that result, perhaps by pattern matching.