[Spatialindex] Namespace use request

Mateusz Loskot mateusz at loskot.net
Tue Oct 20 02:46:16 EEST 2009


Hi,

I was trying to report a bug to the SpatialIndex Trac but it's read only
for me, even after I've registered and logged in.

The spatialindex is a troublemaker. It pollutes global namespace with
its own definitions of types and it uses very common names for this
types. These definitions seriously breaks compilation of client's code
that use different definitions of such aliases. Meaning, the
SpatialIndex defines the following aliases in Tools.h in global namespace:

  typedef __int8 int8_t;
  typedef __int16 int16_t;
  typedef __int32 int32_t;
  typedef __int64 int64_t;
  typedef unsigned __int8 uint8_t;
  typedef unsigned __int16 uint16_t;
  typedef unsigned __int32 uint32_t;
  typedef unsigned __int64 uint64_t;

It clashes with for example boost::uint* and boost::int* types,
with liblas::uint* and liblas::int* types as well as with other
definitions like stdint.h.

For example, even if a client use his own types in properly
namespaced code:

namespace boost
{
   uint32_t a;
}

SpatialIndex' types cause conflict or a full qualificatoin is required.

Elements of SpatialIndex should be defined in namespace or rename all
its integral types using unique names.

Best regards,
-- 
Mateusz Loskot, http://mateusz.loskot.net
Charter Member of OSGeo, http://osgeo.org



More information about the Spatialindex mailing list