[gdal-dev] Should we use boolean type at the SWIG interface?

Tamas Szekeres szekerest at gmail.com
Sun Jul 13 13:58:28 EDT 2008


Frank,

I'd rather not to change the API as I've suggested before because many
existing code may rely on it. By using this change the existing
scripts should use the !=0 suffix in the conditions and this change
may be confusing.

What I would propose now is to change the related code according to
the following example:

bool TestCapability (const char *cap) {
    return OGR_Dr_TestCapability(self, cap) > 0? true: false;
  }

How about this way?

Tamas



2008/7/13 Frank Warmerdam <warmerdam at pobox.com>:
> Tamas Szekeres wrote:
>>
>> Devs,
>>
>> By using boolean type in the SWIG bindings I currently get a number if
>> warnings when compiling the generated code:
>>
>> http://buildbot.osgeo.org:8500/builders/szekerest-vc71-full/builds/36/steps/csharp-make/logs/stdio
>>
>> Since there are no boolean value exposed by the gdal dll I suppose we
>> can use integers instead of booleans at the wrappers as well.
>>
>> Any objection to relpace 'bool' with 'int' in ogr.i?
>
> Tamas,
>
> I believe it would be simplest to expose boolean results as a int.
>
> I see that the C API already treats the return result of TestCapability()
> as an int.  I'm not sure why it was done differently in the swig include
> file.
>
> 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    | President OSGeo, http://osgeo.org
>
>


More information about the gdal-dev mailing list