[geos-devel] c api feedback
Stephen Woodbridge
woodbri at swoodbridge.com
Wed Jul 12 19:29:18 EDT 2006
Charlie,
Thanks for all your work and analysis. I am a user of C-API and I would
vote for consistency. I think the whole idea of a published and
supported API among or things is to provide a consistent view of the
underlying code and to hide some of the oddities that might exist in
that code. I would rather the API take care of things like consistent
return values rather then have to have that spread all over in my code.
Great if it needs a type cast then do it in the wrapper so it is easy to
work with return values.
My 2 cents, which isn't worth that much since I'm doing the coding. And
thanks to all those that are working so hard on this.
Best regards,
-Steve
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.
>
> Charlie
>
>
>
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> geos-devel mailing list
> geos-devel at geos.refractions.net
> http://geos.refractions.net/mailman/listinfo/geos-devel
More information about the geos-devel
mailing list