freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: entropy AT freetds.org
- To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
- Subject: Re: [freetds] CS_INT size bug
- Date: Sun, 03 Sep 2006 16:42:12 -0400
Norbert Sendetzky wrote:
I'm using a standard 32bit x86 machine.
The problem I'm facing are lots of warnings when compiling the sybase backend of my library (OpenDBX, http://www.linuxnetworks.de/opendbx/) against FreeTDS instead of the Sybase ctlib.
In Sybase' ctlib, CS_INT is defined as "long" and as "int" in FreeTDS which is problematic when using printf() functions. This is because of the different expectations gcc/printf have when handling "%d" and "%ld" modifiers.
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.
--
Cheers,
entropy
-
[freetds] CS_INT size bug,
Norbert Sendetzky, 09/02/2006
- Re: [freetds] CS_INT size bug, jklowden, 09/02/2006
- <Possible follow-up(s)>
-
Re: [freetds] CS_INT size bug,
Norbert Sendetzky, 09/03/2006
-
Re: [freetds] CS_INT size bug,
entropy, 09/03/2006
-
Re: [freetds] CS_INT size bug,
jklowden, 09/03/2006
- Re: [freetds] CS_INT size bug, entropy, 09/03/2006
-
Re: [freetds] CS_INT size bug,
jklowden, 09/03/2006
-
Re: [freetds] CS_INT size bug,
entropy, 09/03/2006
- Re: [freetds] CS_INT size bug, michael . peppler, 09/04/2006
-
Re: [freetds] CS_INT size bug,
Norbert Sendetzky, 09/05/2006
- Re: [freetds] CS_INT size bug, entropy, 09/05/2006
-
Re: [freetds] CS_INT size bug,
Lowden, James K, 09/05/2006
- Re: [freetds] CS_INT size bug, entropy, 09/06/2006
-
Re: [freetds] CS_INT size bug,
Norbert Sendetzky, 09/06/2006
- Re: [freetds] CS_INT size bug, entropy, 09/06/2006
- Re: [freetds] CS_INT size bug, Norbert Sendetzky, 09/07/2006
Archive powered by MHonArc 2.6.24.