I don't know - I would think if you did change no SRID to 0, then instead of ignoring -1, we should have it blow up in people's faces at the PostGIS layer if they explicitly try to set it to that with a "This is not a valid SRID rather than casting to unknown" . That will get them used to the new convention. Perhaps its a bit militant, but its better than some strange -1 check dangling in the code (and risking a potential segfault that Mark mentioned). You don't want people wondering down the road who are used to 0 seeing -1 and scratching their heads - "What is this -1 doing here? Why aren't we ignoring all negative SRIDs". R.
________________________________ From: [EMAIL PROTECTED] on behalf of Paul Ramsey Sent: Wed 4/9/2008 12:10 PM To: PostGIS Users Discussion Subject: Re: [postgis-users] 1.3.3 Pre-Release Notice Regina, Actually this logic is good, very old and hasn't worked since it was written, but good. Because if I ever want to change the value of "no SRID" from -1 to 0 (and I *do* want to) then having "undefined" generated as truly undefined is helpful to that end. P. On Wed, Apr 9, 2008 at 9:02 AM, Obe, Regina <[EMAIL PROTECTED]> wrote: > 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: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] 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@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. > > > > _______________________________________________ > postgis-users mailing list > postgis-users@postgis.refractions.net > http://postgis.refractions.net/mailman/listinfo/postgis-users > _______________________________________________ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
_______________________________________________ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users