Latest LQ Deal: Linux Power User Bundle
Go Back > Blogs > TheIndependentAquarius
User Name


Writing better code

Understanding RAII (Resource Acquisition Is Initialization) - C++

Posted 06-14-2012 at 02:45 AM by TheIndependentAquarius
Updated 10-09-2012 at 03:44 AM by TheIndependentAquarius

  • Q: What is an exception safe code?
    A: A code may throw an exception but at the same time if it:
    • Doesn't allow any memory (allocated by it) to be leaked.
    • Lets the program to remain in a well-defined state (no dangling pointers
      and all) so that execution can continue as intended.
    • Reports the error to the caller (when encountered).
    then it can be termed as an exception safe code.

    Of course, a code which won't be throwing any exception ever is an exception
Senior Member
Views 1625 Comments 0 TheIndependentAquarius is offline


All times are GMT -5. The time now is 09:23 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration