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

Paul Ramsey pramsey at cleverelephant.ca
Thu Oct 15 08:00:02 PDT 2009


Harmonize away.

P

On Thu, Oct 15, 2009 at 7:58 AM, Mark Cave-Ayland
<mark.cave-ayland at siriusit.co.uk> wrote:
> 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
> _______________________________________________
> postgis-devel mailing list
> postgis-devel at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-devel
>



More information about the postgis-devel mailing list