[geos-devel] use of const in GeometryFactory constructor

Norman Vine nhv at cape.com
Thu Oct 9 06:10:41 EDT 2003


strk writes:
> 
> GeometryFactory(PrecisionModel * newPrecisionModel, int SRID)
> Will copy the PrecisionModel arg into private space.
> 
> The arguments naming convention used elsewere makes you think
> the PresionModel object has to be created on purpose and thus
> that you'll have to forget about it. Anyway this is not the
> actual implementation and I don't know about usage of it
> by other GEOS parts.
> 
> As a test, I tried to "formalize" the implementation behaviour
> adding a 'const' in front of the first arg both in GeometryFactory.cpp
> and geom.h (and changing the name of it to disambiguate meaning).
> 
> The library resulted by this was corrupted, when trying to run a
> linked executable I got:
> ./example: error while loading shared libraries: ./example: undefined symbol:
> __Q24geos15GeometryFactoryPQ24geos14PrecisionModeli
> 
> Question 1: do you think using 'const' there is the right way to go ?

Most likely
http://www.parashift.com/c++-faq-lite/const-correctness.html
 
> Question 2: do you think I've a bogus compiler ? (gcc-2.96)

If it hasn't been patched *yes* 2.96 was a RedHat special that needed patching 
from it's original release < note this was not an official gnu release >  
check RedHat site for needed patches
http://gcc.gnu.org/gcc-2.96.html

The *real* 3.x series is *much* more C++ standard conformant and seems
to produce slightly faster code esp on the newer procesors

If you do upgrade I reccomend 3.3.1 < the current release >
http://gcc.gnu.org/gcc-3.3/changes.html

Norman



More information about the geos-devel mailing list