freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: michael.peppler AT bnpparibas.com
- To: freetds AT lists.ibiblio.org
- Subject: Re: [freetds] CS_INT size bug
- Date: Mon, 4 Sep 2006 08:02:52 +0200
Actually Sybase defines different sizes for CS_INT depending on 32 or 64bit
wordsize for the platform. This is what the SYB_LP64 #define is for.
CS_INT must be 32bits as it maps to an INT database server datatype
(consider the ct_bind() call, for example).
Michael
Internet
jklowden AT schemamania.org@lists.ibiblio.org - 04/09/2006 00:07
Please respond to freetds AT lists.ibiblio.org
Sent by: freetds-bounces AT lists.ibiblio.org
To: freetds
cc:
Subject: Re: [freetds] CS_INT size bug
On Sun, Sep 03, 2006 at 04:42:12PM -0400, entropy AT freetds.org wrote:
> 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.
That's good advice from a C perspective. The application shouldn't assume
anything about opaque types.
>From the library's perspective, though, maybe we're making a mistake? We
do a bunch of things in the header files -- e.g. use #define instead of
enum
-- just because that's how Sybase did it 20 years ago. It wouldn't be
wrong to change it.
Thanks for pointing it out, Norbert. I don't know what we'll do or what's
even feasible, but it's worth at least discussing.
--jkl
_______________________________________________
FreeTDS mailing list
FreeTDS AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds
This message and any attachments (the "message") is
intended solely for the addressees and is confidential.
If you receive this message in error, please delete it and
immediately notify the sender. Any use not in accord with
its purpose, any dissemination or disclosure, either whole
or partial, is prohibited except formal approval. The internet
can not guarantee the integrity of this message.
BNP PARIBAS (and its subsidiaries) shall (will) not
therefore be liable for the message if modified.
---------------------------------------------
Ce message et toutes les pieces jointes (ci-apres le
"message") sont etablis a l'intention exclusive de ses
destinataires et sont confidentiels. Si vous recevez ce
message par erreur, merci de le detruire et d'en avertir
immediatement l'expediteur. Toute utilisation de ce
message non conforme a sa destination, toute diffusion
ou toute publication, totale ou partielle, est interdite, sauf
autorisation expresse. L'internet ne permettant pas
d'assurer l'integrite de ce message, BNP PARIBAS (et ses
filiales) decline(nt) toute responsabilite au titre de ce
message, dans l'hypothese ou il aurait ete modifie.
-
[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.