[geos-devel] GEOS Exceptions

Frank Warmerdam fwarmerdam at gmail.com
Mon Apr 18 11:46:00 EDT 2005


On 4/18/05, strk at refractions.net <strk at refractions.net> wrote:
> On Mon, Apr 18, 2005 at 11:16:45AM -0400, Frank Warmerdam wrote:
> > Folks,
> >
> > I must confess I am not a particular advanced C++ programmer.  I
> > tend to avoid use of C++ exceptions, so now I find myself in a situation
> > where I am not quite sure what to do.
> 
> I really think this is a GEOS bug, in that it throws by pointer
> instead of by reference.
> I'm somehow happy to know you faced this so maybe you'll support a
> switch to a throw-by-reference-of-std::exception-derived, altought
> it will be a big API break.

Niki / Norman --- thanks the change fixed up my problem. 

Strk,

I certainly don't know how bad a practice throwing exceptions
by pointer is, but I am quite adverse to such changes like this
that require every application using GEOS to be changed.  It is
churn like this that poisons folks against using a library.   If you are
going to make the change, I think you should go a bit further and
rename the exception class to ensure that folks can't compile
with the new version till they revisit this area, though even that won't
ensure they know the new expected calling conventions.  In fact, 
I would suggest just putting this on a "todo list" for the next major
compatibility break - even if that is a long ways in the future. 

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent



More information about the geos-devel mailing list