Is there any efficiency drop when using these error-control keywords? Even in instances where they aren't controlling error?
Is there any efficiency drop when using these error-control keywords? Even in instances where they aren't controlling error?
Essentially a throw is just a return of an object, and it's just as efficient as that.
It is recommended to not use exceptions except when signalling errors, though. It provides no benefit, and has pitfalls -- exception safety has to be designed for from the ground up.
There are a few overheads for exception handling even if an exception isnt thrown. They are pretty modest though, and unless you are pushing the efficiency of your overall code to the maximum, you shouldnt really be bothered by it.Originally posted by ygfperson
Is there any efficiency drop when using these error-control keywords? Even in instances where they aren't controlling error?