[geos-devel] use of const in GeometryFactory constructor

Paul Ramsey pramsey at refractions.net
Thu Oct 9 13:06:25 EDT 2003


Keep in mind that some of the design decisions WRT pass-by-reference vs 
pass-by-value were made for performance reasons early on. Check your 
performance with the TestLineSweep program regularly and make sure 
things do not get worse while they get better...

P.

strk wrote:
> Ok, problems with compiler seems to be gone (dunno how)...
> I've already added a const keyword to PrecisionModel *
> argument of GoemetryFactory constructor.
> 
> Right now I'm in the process of formalizing the const nature
> of the CoordinateList * passed to the LineString constructor,
> and this is being really really long ... it is tainting the
> whole code set !
> 
> .. we might have found a good way to consistency ..
> 
> --strk;
> 
> 
> nhv wrote:
> 
>>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
>>
>>_______________________________________________
>>geos-devel mailing list
>>geos-devel at geos.refractions.net
>>http://geos.refractions.net/mailman/listinfo/geos-devel
> 
> 
> _______________________________________________
> geos-devel mailing list
> geos-devel at geos.refractions.net
> http://geos.refractions.net/mailman/listinfo/geos-devel

-- 
       __
      /
      | Paul Ramsey
      | Refractions Research
      | Email: pramsey at refractions.net
      | Phone: (250) 885-0632
      \_




More information about the geos-devel mailing list