GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Programming  >  C++
Go To First  |  Previous Question  |  Next Question 
 C++  |  Question 165 of 203    Print  
Exception handling vs. return values to signal an error
Why we would use exception handling rather than different return values to signal an error?


  
Total Answers and Comments: 3 Last Update: November 01, 2009     Asked by: langleq9 
  
 Sponsored Links

 
 Best Rated Answer
Submitted by: jeetsahu
 
exception are not errors in true sense,

through exception handling we can handle that exception but by returning values we cannot handle that error.

generally exception occurs when logic and syntax is also correct but in some cases it does not give desired output

Above answer was rated as good by the following members:
gshcherb, SetaSohjiro
July 16, 2008 09:42:13   #1  
jeetsahu Member Since: July 2008   Contribution: 1    

RE: Exception handling vs. return values to signal an error
exception are not errors in true sense

through exception handling we can handle that exception but by returning values we cannot handle that error.

generally exception occurs when logic and syntax is also correct but in some cases it does not give desired output

 
Is this answer useful? Yes | NoAnswer is useful 2   Answer is not useful 0Overall Rating: +2    
September 29, 2008 02:45:17   #2  
hrisheekesh.kale27 Member Since: September 2008   Contribution: 4    

RE: Exception handling vs. return values to signal an error
The exception handling sort of becomes necessary when we want to handle error in constructors.
 
Is this answer useful? Yes | No
November 01, 2009 01:43:33   #3  
thumbeti Member Since: November 2009   Contribution: 2    

RE: Exception handling vs. return values to signal an error
Using exceptions it becomes easy to pass multiple types of values from a single function. Handling the exceptions is hirachical.

If we dont have exceptions it will be difficult to return multiple values from a function.

 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape