LWN.net Logo

Quotes of the week

Quotes of the week

Posted Jul 4, 2012 9:28 UTC (Wed) by Cyberax (✭ supporter ✭, #52523)
In reply to: Quotes of the week by twm
Parent article: Quotes of the week

Nope.

You DON'T need try..except blocks in correctly designed code. Well, you need them, but mostly on the upper level. The main reason for their use it to free acquired resources in case of exceptional conditions and that can be done well by "with(res):" statements (try-with-resources in Java).

C++ has an even better mechanism - destructors. It has a tremendous advantage over other error handling mechanisms because it unites error handling paths and normal exit paths.


(Log in to post comments)

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds