[geos-devel] Problem in Geometry.getCoordinate() implementations
Martin Davis
mbdavis at VividSolutions.com
Fri Jan 31 14:02:10 EST 2003
Yury, I'm getting the following when I compile:
Coordinate& LineString::getCoordinate() {
if (isEmpty()) return Coordinate();
return points->getAt(0);
}
H:\proj\GEOS\src\geos\source\geom\LineString.cpp(189) : warning C4172: returning address of local variable or temporary
(a) Do you not get this message? There's some other places it's occuring as well. We need to fix this, since this message is correct - we should not be returning references to local objects.
In this particular case, the fix should be to return null (0). However, apparently we can't return null as a reference. In this case I guess we need to return a pointer instead of a reference. (The other option would be to return a value of Coordinate - I can't remember if we tried this in general and found performance problems - can you?)
Martin Davis, Senior Technical Specialist
Vivid Solutions Inc.
Suite #1A-2328 Government Street Victoria, B.C. V8T 5G5
Phone: (250) 385 6040 Fax: (250) 385 6046
EMail: mbdavis at vividsolutions.com Web: www.vividsolutions.com
More information about the geos-devel
mailing list