[geos-devel] patch to make geos compile with gcc 2.95

Bernhard Herzog bh at intevation.de
Mon Mar 14 14:17:09 EST 2005



I've briefly tested geos a bit with postgis.  I needed to make two
changes to geos-2.1.1.tar.bz2 to get it to compile on my system which
uses gcc 2.95.4.  One was the stdio include for sprintf which has
already been reported.  

The other is that at least one of LineStringAdder's methods tries to
access a private member of Polygonizer.  LineStringAdder is a nested
class inside of Polygonizer but that doesn't automatically give it
access to Polygonizer's private members.  The patch below makes
LineStringAdder a friend of Polygonizer to fix this.  Newer versions of
gcc apparently allow this kind of access, but gcc 2.95 is correct in
rejecting it, AFAIK.  Stroustrup 3rd ed. says:

   C.11.3  Access to Member Class

   The members of a member class have no special access to members of an
   enclosing class.



*** source/headers/geos/opPolygonize.h.~1~	Tue Dec 14 11:35:44 2004
--- source/headers/geos/opPolygonize.h	Fri Mar 11 14:56:41 2005
***************
*** 397,402 ****
--- 397,407 ----
  		void filter_ro(const Geometry *g){};
  	};
  
+ 	// Make LineStringAdder a fried of Polygonizer so that
+ 	// LineStringAdder's methods can access Polygonizer's private
+ 	// parts.
+ 	friend LineStringAdder;
+ 
  	// default factory
  	LineStringAdder *lineStringAdder;
  



 Bernhard

-- 
Intevation GmbH                                 http://intevation.de/
Skencil                                           http://skencil.org/
Thuban                                  http://thuban.intevation.org/



More information about the geos-devel mailing list