[geos-devel] c api feedback

Charlie Savage cfis at savagexi.com
Wed Jul 12 17:36:42 EDT 2006

> 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.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3237 bytes
Desc: S/MIME Cryptographic Signature
Url : http://lists.osgeo.org/pipermail/geos-devel/attachments/20060712/8480af2e/smime.bin

More information about the geos-devel mailing list