I've read about exception handling, but I don't understand why they are better than the old way.
is exception handling faster?
why should I do this:
rather than this:Code:void func(int x, int y) { if (x != y) throw "they are equal"; else cout << x - y; }
I would use the second variant, because I write less when calling the function.Code:bool func(int x, int y) { if (x != y) return false; cout << x - y; return true; }
So, why is exception handling better?
P.S. the function is not supposed to be useful, it's just for showing the difference.




Reply With Quote