[LC++]Exceptions vs. Errors

Paul M Foster paulf at quillandmouse.com
Fri Apr 19 08:18:05 UTC 2002


On Thu, Apr 18, 2002 at 01:49:18PM -0400, Jack Lloyd wrote:

> I find the
> try/throw/catch syntax ugly enough that I don't like using it unless I have
> to.
> 

You noticed that, too? I'm sure some people find it sublime, but I
don't. Plus, you _must_ include braces. You can't just treat it the way
you do "if":

if (something)
	do_it;
else
	dont_do_it;

No, with try/catch, you _have_ to have braces. This won't work:

try
	action;
catch
	fixup;

One other thought about exceptions is that, where you have mixed
exceptions/error codes, you have to remember which functions need
try/catches, and which can just test a return value.

Paul




More information about the tuxCPProgramming mailing list