[geos-devel] c api feedback

strk at refractions.net strk at refractions.net
Thu Jul 27 21:50:46 EDT 2006


On Wed, Jul 12, 2006 at 03:36:42PM -0600, Charlie Savage wrote:
> >1.  The methods GEOSCoordSeq_getSize and GEOSCoordSeq_getDimensions 
> >return their results by updating a pointer to a size_t parameter.  Thus 
> >like this:
> >
> >GEOSCoordSeq_getSize(const GEOSCoordSeq s, size_t *size);
> >
> >In contrast, these methods just return the result:
> >
> >GEOSGeom_getDimensions returns value, not as a parameter
> >GEOSGeom_getNumcoordinates
> >GEOSGeom_getNumInteriorRings
> >GEOSGeom_getNumGeometries
> >
> >Seems like an unneeded inconsistency.
> 
> A follow up to this.  The methods like GEOSGeom_genNumcoordinates are 
> defined like this:
> 
> /* Return -1 on exception */
> extern size_t GEOS_DLL GEOSGetNumCoordinates(const GEOSGeom g1);
> 
> However, size_t is defined as:
> 
> typedef unsigned int size_t
> 
> So returning -1 isn't such a good idea is it?  You'd have to type cast 
> to an int first to check the result.

We also don't want to be limited on CoordinateSequence size, I think.
-1 would just be UINT_MAX from limits.h (w/out typecast)
Maybe we should update docs.

--strk;





More information about the geos-devel mailing list