[Gdal-dev] Bool vs int in bindings?

Simon Perkins sy at perkins.net
Tue Apr 3 01:01:05 EDT 2007


Hi,

A lot of the SWIG generated binding functions use ints as arguments and 
return types when a boolean type would be more appropriate, e.g. the OGR 
Open() method takes an int as the second argument to indicate whether 
the file should be opened with update access, and the 
SpatialReference.IsGeographic() method returns an int. It would be nice 
to use a more natural bool in these cases for languages that support it.

Would I be right in thinking that there's pretty much no way of changing 
this now without breaking a lot of code? What about just changing it for 
some of the newer bindings, e.g. C#, that have recently had breaking API 
changes applied anyway. I like the new enums, etc for the C# bindings in 
place of int constants, can we fix the bool vs int problem there as 
well? I'd be happy to do this if people want to fix it, and Tamas 
doesn't have time.

And while we're changing this, should wkbGeometryType be WkbGeometryType?

Cheers,

Simon




More information about the Gdal-dev mailing list