[postgis-users] Building PostGis with VC++

Charlie Savage cfis at savagexi.com
Tue Aug 28 18:59:21 PDT 2007


> Could you specify what version of Visual C++ you're using?
> Just for clarification.

VC++ 2005.

> Possible workaround is to compile .c file in C++ mode (use /TP instead
> of /TC option).

I suppose, but why not just fix it.  If I remember correctly, it 
happened only a couple times in the new files for supporting curved 
geometry.  They were very simple changes.

>> * VC++ thought MAX_FLOAT was too big (3.40282347e+38F versus
>> 3.402823466e+38F)

> 
> Hmm, could you point where this constant is used?


Ah, sorry, got the name slightly wrong.  See lwcurve.c, line 24

#ifndef MAXFLOAT
   #define MAXFLOAT      3.40282347e+38F
#endif

According to VC++ that's too big.  Which leads to an interesting 
question as to why GCC doesn't think so.

> 
>> * The method createTree must use some GCC magic to initialize a variable
>> sized array:
>>
>>         RTREE_NODE *nodes[pointArray->npoints];
>>
>> That has to be done via malloc/free on Windows.
> 
> Visual C++ does not support VLA, so this code is well unsupported by
> Microsoft's compiler.

Right - but easy enough to dynamically allocate the array using 
malloc/free (well I guess palloc) like in other places in PostGis - its 
just 2 lines more of code.

> Simply, Visual C++ does not support features from addendum to the C
> language standard, but only plain C89.

Yup.  And of course other people have had the same issues so its easy to 
find workarounds.

> Perhaps, pj_errno could be replaced with function pointers, as it errno
> global is solved in newer and thread-safe implementations of C library.
> 
> extern int* pj_errno_proxy(void);
> #define errno (*pj_errno_proxy())

Either this way or just having a simple function that returns the value. 
  Depends if you want an event like interface or not.

> p.s. i've taken the liberty to give my 5 cents :-)

Thanks for the thoughts.  Should I send a patch along for review?

Charlie
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3237 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20070828/a6aea9ba/attachment.bin>


More information about the postgis-users mailing list