Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Error Handling in C++

Posted on 2006-05-06
2
Medium Priority
?
152 Views
Last Modified: 2010-04-01
What other ways are available for error handling in C++ besides throwiing an exception? Is one type better to use than the other? What kind of scenarios would they be used in?
0
Comment
Question by:Wookie68
2 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 1000 total points
ID: 16623599
You basically have two choices - the one being exception, the other returning error codews from function calls. Both have their pros and cons, but I'd say it depends on the actual situation which weapon you choose. If you e.g. work with a library that makes use of throwing exeptions (just as e.g. STL), you better pick that concept, if you are only orking with an APIesque construct, return values are OK. Even a healthy mixture of both can have some real beauty.
0
 
LVL 8

Expert Comment

by:Dariusz Dziara
ID: 16624637
You can always create wrapper that will turn error code into exception or exception into error code.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question