[freetds] FreeTDS Digest, Vol 44, Issue 4

Norbert Sendetzky norbert at linuxnetworks.de
Mon Sep 4 12:12:28 EDT 2006


On Monday 04 September 2006 18:00, freetds-request at lists.ibiblio.org wrote:
> The problem is that your code is making assumptions about what type a
> CS_INT is.  If it were reasonable for your code to do that, then there
> would be no such thing as a CS_INT, and instead it would just be "int"
> or "long".
>
> The most portable thing your code can do in this case is explicitly cast
> to a type, then use the printf(3) format for that type.
>
> CS_INT foo;
> ...
> printf("%ld\n", (long) foo);
>
> That should compile without warnings and execute properly, using FreeTDS
> or Sybase headers, on any 32 or 64 bit platform.

It's not that I want to make assumptions about types but printf forces me to 
do so. Your example above works as long as it doesn't hit a plattform 
where "long" is defined as 64 bit type (e.g. Alpha, AIX). On these 
plattforms, it will fail miserably.

On the other hand I don't know if there is a way out of this problem when two 
libraries define CS_INT different. For the moment people using the sybase 
backend in combination with FreeTDS have to live with this warnings.

Thanks


Norbert
-- 
OpenPGP public key
http://www.linuxnetworks.de/norbert.pubkey.asc

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.ibiblio.org/pipermail/freetds/attachments/20060904/40c66cfa/attachment.bin 


More information about the FreeTDS mailing list