<HTML dir=ltr><HEAD><TITLE>Re: [postgis-users] 1.3.3 Pre-Release Notice</TITLE>
<META http-equiv=Content-Type content="text/html; charset=unicode">
<META content="MSHTML 6.00.2900.3314" name=GENERATOR></HEAD>
<BODY>
<DIV id=idOWAReplyText21769 dir=ltr>
<DIV dir=ltr><FONT face=Arial color=#000000 size=2>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&nbsp;at the PostGIS layer if they explicitly try to set it to that&nbsp;with a "This is not a valid SRID rather than casting to unknown"&nbsp;. That will get them used to the new convention.&nbsp;&nbsp; </FONT></DIV>
<DIV dir=ltr><FONT face=Arial color=#000000 size=2></FONT>&nbsp;</DIV>
<DIV dir=ltr><FONT face=Arial color=#000000 size=2>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).&nbsp;&nbsp;You don't want &nbsp;people wondering down the road who are used to 0 seeing -1 and scratching their heads&nbsp;- "What is this -1 doing here?&nbsp; Why aren't we ignoring all negative SRIDs".</FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV dir=ltr><FONT face=Arial size=2>R.</FONT></DIV></DIV>
<DIV dir=ltr><BR>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> postgis-users-bounces@postgis.refractions.net on behalf of Paul Ramsey<BR><B>Sent:</B> Wed 4/9/2008 12:10 PM<BR><B>To:</B> PostGIS Users Discussion<BR><B>Subject:</B> Re: [postgis-users] 1.3.3 Pre-Release Notice<BR></FONT><BR></DIV>
<DIV>
<P><FONT size=2>Regina,<BR><BR>Actually this logic is good, very old and hasn't worked since it was<BR>written, but good.&nbsp; Because if I ever want to change the value of "no<BR>SRID" from -1 to 0 (and I *do* want to) then having "undefined"<BR>generated as truly undefined is helpful to that end.<BR><BR>P.<BR><BR>On Wed, Apr 9, 2008 at 9:02 AM, Obe, Regina &lt;robe.dnd@cityofboston.gov&gt; wrote:<BR>&gt; This may be a dumb question, but why can't we just skip the strcmp<BR>&gt;&nbsp; altogether?<BR>&gt;<BR>&gt;&nbsp; I mean if you do<BR>&gt;<BR>&gt;&nbsp; if (sr_id)<BR>&gt;<BR>&gt;&nbsp; and someone did happen to explicity set their sr_id = "-1"<BR>&gt;<BR>&gt;&nbsp; then&nbsp; what happens<BR>&gt;<BR>&gt;&nbsp; "SRID=-1;"<BR>&gt;<BR>&gt;&nbsp; Isn't that still legal and gets kicked out by Postgis anyway.<BR>&gt;<BR>&gt;<BR>&gt;&nbsp; Thanks,<BR>&gt;&nbsp; Regina<BR>&gt;<BR>&gt;&nbsp; -----Original Message-----<BR>&gt;&nbsp; From: postgis-users-bounces@postgis.refractions.net<BR>&gt;&nbsp; [<A href="mailto:postgis-users-bounces@postgis.refractions.net">mailto:postgis-users-bounces@postgis.refractions.net</A>] On Behalf Of Paul<BR>&gt;&nbsp; Ramsey<BR>&gt;<BR>&gt; Sent: Wednesday, April 09, 2008 11:23 AM<BR>&gt;&nbsp; To: PostGIS Users Discussion<BR>&gt;&nbsp; Subject: Re: [postgis-users] 1.3.3 Pre-Release Notice<BR>&gt;<BR>&gt;<BR>&gt;<BR>&gt; &gt;&nbsp; if ( sr_id &amp;&amp; strcmp(sr_id,"-1") ) printf("SRID=%s;", sr_id);<BR>&gt;&nbsp; &gt;<BR>&gt;&nbsp; &gt;&nbsp; I have a very strong feeling that evaluation order in C is<BR>&gt;&nbsp; unspecified, rather<BR>&gt;&nbsp; &gt;&nbsp; than being from left to right; so for example the compiler could<BR>&gt;&nbsp; decide to<BR>&gt;&nbsp; &gt;&nbsp; generate code that evaluates the strcmp() first, in which case it<BR>&gt;&nbsp; would<BR>&gt;&nbsp; &gt;&nbsp; segfault on a NULL :( I think you would need to re-write something<BR>&gt;&nbsp; like this:<BR>&gt;<BR>&gt;&nbsp; Should be fine: man -S7 operator<BR>&gt;<BR>&gt;&nbsp; &gt;&nbsp; if (sr_id)<BR>&gt;&nbsp; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (strcmp(sr_id,"-1") ) printf("SRID=%s;", sr_id);<BR>&gt;&nbsp; &gt;<BR>&gt;&nbsp; &gt;&nbsp; (looks even closer...)<BR>&gt;<BR>&gt;&nbsp; &gt;&nbsp; In fact, why is sr_id stored as a string anyway? We should make sr_id<BR>&gt;&nbsp; an<BR>&gt;&nbsp; &gt;&nbsp; integer with a default value of -1, and then use sscanf() within the<BR>&gt;&nbsp; switch()<BR>&gt;&nbsp; &gt;&nbsp; statement of pgis_getopt() to read its value.<BR>&gt;<BR>&gt;&nbsp; I'll have a look at that, how is the estimated_extent investigation<BR>&gt;&nbsp; coming?<BR>&gt;<BR>&gt; _______________________________________________<BR>&gt;&nbsp; postgis-users mailing list<BR>&gt;&nbsp; postgis-users@postgis.refractions.net<BR>&gt;&nbsp; <A href="http://postgis.refractions.net/mailman/listinfo/postgis-users">http://postgis.refractions.net/mailman/listinfo/postgis-users</A><BR>&gt;<BR>&gt; -----------------------------------------<BR>&gt;&nbsp; The substance of this message, including any attachments, may be<BR>&gt;&nbsp; confidential, legally privileged and/or exempt from disclosure<BR>&gt;&nbsp; pursuant to Massachusetts law. It is intended<BR>&gt;&nbsp; solely for the addressee. If you received this in error, please<BR>&gt;&nbsp; contact the sender and delete the material from any computer.<BR>&gt;<BR>&gt;<BR>&gt;<BR>&gt; _______________________________________________<BR>&gt;&nbsp; postgis-users mailing list<BR>&gt;&nbsp; postgis-users@postgis.refractions.net<BR>&gt;&nbsp; <A href="http://postgis.refractions.net/mailman/listinfo/postgis-users">http://postgis.refractions.net/mailman/listinfo/postgis-users</A><BR>&gt;<BR>_______________________________________________<BR>postgis-users mailing list<BR>postgis-users@postgis.refractions.net<BR><A href="http://postgis.refractions.net/mailman/listinfo/postgis-users">http://postgis.refractions.net/mailman/listinfo/postgis-users</A><BR></FONT></P></DIV></BODY></HTML>