[freetds] tds_money_to_string conversion oddity

Craig Berry craigberry at mac.com
Mon Dec 8 12:47:31 EST 2003


 
On Monday, December 08, 2003, at 09:17AM, Lowden, James K <LowdenJK at bernstein.com> wrote:

>> From: Craig A. Berry [mailto:craigberry at mac.com]
>> Sent: December 7, 2003 9:00 AM
>> 
>> Actually from browsing CVS it looks like the test you are doing is:
>> 
>> #if SIZEOF_LONG < 8
>> 
>> which means that sizeof(long int) < 8, but I think what you really
>> want is sizeof(long long int) or perhaps sizeof(__int64)  since a
>> long int is sometimes (usually?) still 32 bits even on 64-bit
>> platforms.  
>
>On Alpha Tru64, a long is 64 bits.  What 64-bit system do you use that has a
>32-bit long?  

VMS on Alpha and Itanium. Freddy indicated Windows also does this, and someone else has now pointed out AIX does the same thing.  And there's no particular reason that a compiler on a 32-bit architecture might not support 64-bit integers one way or another.  It's more complicated than I thought, but my original point (which I didn't express very clearly) still holds, namely that if what we want to test for is whether 64-bit integers are available and supported, sizeof(long) is a poor indicator of that.  The Configure script for Perl provides an example of how to figure out whether 64-bit integers are available and what to call them if they are: do a grep on "quadtype".  Maybe it's not important enough to go to that trouble, but I get the feeling from Freddy's comments that it's much better to use them if you have them.


More information about the FreeTDS mailing list