[LC++]Exceptions vs. Errors

hursh hursh at infonet.isl.net
Fri Apr 19 13:13:04 UTC 2002


	I find I like exceptions because I tend to write functions that return 
something (like say an int) for which all the possible values are in 
fact valid, but there are still possible error conditions (like 
overflow) that need to be reported.  The only way to do this w/o 
exceptions is to use some perversion like errno.
	I can't say though that I'm in love with the syntax either.  The extra 
braces just seem to hurt formating to me.  I'm hoping I'll like what 
they are doing in perl 6.  It still needs braces, but any set will do.

Dan

Paul M Foster wrote:

> 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
> 
> _______________________________________________
> This is the Linux C++ Programming List
> : http://lists.linux.org.au/listinfo/tuxcpprogramming List
> 







More information about the tuxCPProgramming mailing list