Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Coffee corner » Raise Exception instead of ASSERT for container
Re: Raise Exception instead of ASSERT for container [message #12041 is a reply to message #12035] Tue, 09 October 2007 15:07 Go to previous messageGo to previous message
tvanriper is currently offline  tvanriper
Messages: 85
Registered: September 2007
Location: Germantown, MD, USA
Member
I'm not a personal fan of exceptions, myself, unless the reason for the exception is fairly extraordinary.

I guess it's kind of a matter of opinion as to whether or not this sort of thing merits an exception.

If you're thinking like a C programmer, yeah, it merits it. After all, you're potentially accessing unallocated memory (always a no-no).

But if you're thinking like a C++ programmer, it may not. We're working with objects here, who can return other objects. The object returned may hold state that indicates an error (or may itself be indicative of an error).

One need only test the object to ensure its validity before proceeding... no exception required, and the code is extremely straight-forward to read (doesn't potentially jump around to some catch(...) statement).

I suppose, though, one could optionally 'enable' exceptions in the object, in case that form of error handling is for some reason preferable.
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: downloadable U++ manual
Next Topic: Vista.....
Goto Forum:
  


Current Time: Thu May 09 14:36:43 CEST 2024

Total time taken to generate the page: 0.01395 seconds