What should one catch?, C/C++ Programming

A: By keeping along with the C++ tradition of "there's more than one method to do that" (translation: "give programmers options & tradeoffs so they can choose what's best for them in their situation"), C++ let you a variety of options for catching.

Ø  Catch by value.

Ø  Catch by reference.

Ø  Catch by pointer.

Actually, you have all the flexibility that you have in declaring function parameters, and the rules for whether a specific exception matches (that means will be caught by) a specific catch clause are almost accurately the same as the rules for parameter compatibility while calling a function.

Given all this flexibility, how do you choose what to catch? Simple: unless there's a good motive not to, catch by reference. Avoid catching by value, as that causes a copy to be made and the copy can have distinct behavior from what was thrown. Only under extremely special circumstances should you catch by pointer.

 

Posted Date: 3/19/2013 8:56:10 AM | Location : United States







Related Discussions:- What should one catch?, Assignment Help, Ask Question on What should one catch?, Get Answer, Expert's Help, What should one catch? Discussions

Write discussion on What should one catch?
Your posts are moderated
Related Questions
Byteland county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of various luminous jewels of particular colour. Nec

write a program to calculate gross salary and net salary using hra da pf in c++

flow chart for prime or not

what is poiter

Rewrite the recursive bisection root finding function from lecture to be iterative (using a while loop). The function declaration should be root = bisectIter(f,a,b,tol). The input

Describe Processing an array? The Single operations which involve complete arrays are not permitted in C language. therefore if a and b are similar arrays (for example same dim

how can i write reverse digit function like writing 1234 and printing 4321

Project Description: I want someone with experience on adding/compiling/installing the OpenVPN client software within an IP network camera's embedded operating system. Either if

Byteland county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of various luminous jewels of particular colour. Nec

program for decode the encoded numbering format into message