[postgis-users] 1.3.3 Pre-Release Notice

Obe, Regina robe.dnd at cityofboston.gov
Wed Apr 9 09:02:38 PDT 2008


This may be a dumb question, but why can't we just skip the strcmp
altogether?

I mean if you do

if (sr_id) 

and someone did happen to explicity set their sr_id = "-1"

then  what happens

"SRID=-1;"

Isn't that still legal and gets kicked out by Postgis anyway.

Thanks,
Regina

-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Paul
Ramsey
Sent: Wednesday, April 09, 2008 11:23 AM
To: PostGIS Users Discussion
Subject: Re: [postgis-users] 1.3.3 Pre-Release Notice

>  if ( sr_id && strcmp(sr_id,"-1") ) printf("SRID=%s;", sr_id);
>
>  I have a very strong feeling that evaluation order in C is
unspecified, rather
>  than being from left to right; so for example the compiler could
decide to
>  generate code that evaluates the strcmp() first, in which case it
would
>  segfault on a NULL :( I think you would need to re-write something
like this:

Should be fine: man -S7 operator

>  if (sr_id)
>         if (strcmp(sr_id,"-1") ) printf("SRID=%s;", sr_id);
>
>  (looks even closer...)

>  In fact, why is sr_id stored as a string anyway? We should make sr_id
an
>  integer with a default value of -1, and then use sscanf() within the
switch()
>  statement of pgis_getopt() to read its value.

I'll have a look at that, how is the estimated_extent investigation
coming?
_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users
-----------------------------------------
The substance of this message, including any attachments, may be
confidential, legally privileged and/or exempt from disclosure
pursuant to Massachusetts law. It is intended
solely for the addressee. If you received this in error, please
contact the sender and delete the material from any computer.




More information about the postgis-users mailing list