CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Threaded View

  1. #1
    Join Date
    Jan 2009
    Location
    In a cave on Mars
    Posts
    30

    exception handling

    Which of the following statements describe correct methods of handling C++ exceptions?

    A. In a hierarchy of exception classes, the order of handling exceptions can be from the most specific class to the most general class.
    B. Once an exception is thrown, the compiler unwinds the heap, freeing any memory dynamically allocated within the block from which the exception was thrown.
    C. If an exception is caught by its address or pointer, it is the responsibility of the thrower to release the memory occupied by the exception.
    D. Catching an exception by reference is preferable to catching it by value.
    E. To write an exception handler, it is essential to know the concrete class of exception to catch.

    Ok,
    * A is correct, because ya can do exception handling anywhere.
    * B is incorrect, becuase you need to free the memory yourself when you do a try/catch
    * C is correct, because of what I said about B
    * D is correct, because it you just have its value you can't free its reference.
    * E - unsure, I don't understand the answer.

    Can someone please confirm/comment? Thx.
    Last edited by coletek; January 12th, 2009 at 04:01 AM.
    "What comes around, goes around"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured