How is a try catch block evaluated?
Afficher commentaires plus anciens
Hi, I wonder how a try-catch block is evaluated in matlab. In particular, is the try-catch block evaluated in runtime or compile time?
Also, is a try-catch block expensive?
If someone have a link to any documentation that would be much appreciated.
(Btw, I know that try-catch is not the best solution in most cases. Still I would like to know how it works, since I have used it in some code).
Réponse acceptée
Plus de réponses (1)
Adam
le 22 Août 2014
0 votes
It is evaluated at runtime. There is no compilation in Matlab so most things are done at runtime (excluding Mex compilation and similar).
I may be misunderstanding the question though. Even in C++ it is evaluated at runtime, because you don't know at compile time if something will throw an exception. If it would always throw an exception known at compile time then I'd imagine that's some bad coding design.
2 commentaires
Adam
le 22 Août 2014
Yes, true, I was rolling in the JIT compilation with runtime activity, but should have said there is no pre-compilation.
Catégories
En savoir plus sur COM Component Integration dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!