[Gdal-dev] WKB byte order and SWIG

Charlie Savage cfis at interserv.com
Tue Jan 17 14:34:02 EST 2006


Something that tripped me up today.  I see in the SWIG bindings for OGR 
  that the byte order is assumed to be big endian (from ogr.i):

OGRErr ExportToWkb( int *nLen, char **pBuf, OGRwkbByteOrder 
byte_order=wkbXDR ) {
   }

Note that default parameter.  This seems to me like a really bad idea, 
because it means you can write code on an Intel computer (which is what, 
95% of all computers people use?) like this:

wkb1 = geom1.export_to_wkb()

And have no idea that the result you just got back is wrong.  I think 
that byteOrder should not have a default value - and if it must, it 
really should be wkbNDR.

Unless someone says something, I plan on removing the default value and 
making this a required parameter, just like it is in the C OGR API.

Charlie




More information about the Gdal-dev mailing list