I heard people say that exception handling is a bit expensive due to a stack break.
I donโt get anything, the expansion of the stack occurs if I throw an exception and if I use โreturnโ. So where is the difference?
If, for example, I get a memory problem that I cannot handle, the only option is to stop the function until I get to the area where the problem needs to be processed or notified. So what is my other option for throwing exceptions?
I can use "return" instead of throwing exception, but then it is the same. I know that expanding the stack can even go back six stacks, but so checking the return value and "return" in combination.
An explanation would be welcome.
source
share