
Hugh Wimberly wrote:
I could be way off base here, but I assumed the question related to the use of try/catch blocks, which are very expensive
What is that claim based on? The old myth saying exceptions are slower than return values, while it's actually the opposite?
compared to unmanaged code.
What is that supposed to mean? C++ has no notion of managed/unmanaged code. Even when considering the Microsoft extensions, I still don't see what exceptions have to do with managed code. (since you compare exceptions to "unmanaged" code that must mean you must consider those "managed")
The divide by zero question is easy to answer, because unless one of the values is volatile, then it's more efficient to check the denominator before the division than put the division in a try/catch block.
I don't understand how not using exceptions allow better efficiency. If you want to detect the error, you have to make a test in both cases. What's different is the way of transmitting the error.