Skip to Content.
Sympa Menu

freetds - Re: [freetds] FreeTDS Digest, Vol 44, Issue 4

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Norbert Sendetzky <norbert AT linuxnetworks.de>
  • To: freetds AT lists.ibiblio.org
  • Subject: Re: [freetds] FreeTDS Digest, Vol 44, Issue 4
  • Date: Mon, 4 Sep 2006 18:12:28 +0200

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

Attachment: pgpk_uOiuRa0U.pgp
Description: PGP signature




Archive powered by MHonArc 2.6.24.

Top of Page