[LC++]To try or not

David filiond at videotron.ca
Sat Sep 28 03:48:01 UTC 2002


I'm relatively comfortable with the syntax of exceptions.  The problem I 
have is I'm still not sure when I should use them.

Is there some standard as too when function should use a return code 
(ie. return an int) or when it should use exceptions?

I guess what I'm trying to say is, when do I do this:

if (foo() == -1)
	cout << "Error!" << endl;

And when do I do this:

try {
	foo();
}
catch (int i) {
	cout << "Error, code: " << i << endl;
}


-- 
David Filion
Registerd (Slackware) linux user #195143



More information about the tuxCPProgramming mailing list