[postgis-devel] FLAGS_SET_* macros in libgeom.h don't actually set the value

Mark Cave-Ayland mark.cave-ayland at siriusit.co.uk
Thu Oct 15 07:58:05 PDT 2009


Hi all,

In the new geography code, I've been tripped up a couple of times doing 
something like this:

FLAGS_SET_GEODETIC(search_box.flags, 1);
if (!lwgeom_calculate_gbox_geodetic(geometry, &search_box))
{
	...
}

Contrary to popular belief, the FLAGS_SET_GEODETIC() macro doesn't 
actually *set* the search_box geodetic flag, but merely returns what the 
flags parameter should be once the geodetic flag has been set. So at the 
moment, you must remember to do something like this:

search_box.flags = FLAGS_SET_GEODETIC(search_box.flags, 1);

This behaviour seems to go against general convention, especially in 
that the PostgreSQL macros such as SET_VARSIZE() change the variable 
directly. Would anyone mind if I go through the geography code and alter 
the FLAGS_SET_* macros and callees so that we don't need this additional 
assignment at the front?


ATB,

Mark.

-- 
Mark Cave-Ayland - Senior Technical Architect
PostgreSQL - PostGIS
Sirius Corporation plc - control through freedom
http://www.siriusit.co.uk
t: +44 870 608 0063

Sirius Labs: http://www.siriusit.co.uk/labs



More information about the postgis-devel mailing list