Re: long ints use for 4-byte entities in ODBC

From: Andrew Bell <acbell(at)iastate(dot)edu>
To: Nick Gorham <nick(at)easysoft(dot)com>, Peter Harvey <pharvey(at)codebydesign(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: long ints use for 4-byte entities in ODBC
Date: 2001-12-20 16:55:56
Message-ID: 5.1.0.14.2.20011220105223.050057e8@acbell.mail.iastate.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

At 11:41 AM 12/20/2001 +0000, Nick Gorham wrote:
>Peter Harvey wrote:
>
> > > I was installing the ODBC driver on an alpha box. Problem is that there
> > > are assumptions in the typedefs that a four byte integer is a "long
> > > int". Of course, this is often an incorrect assumption. I can fix this,
> > > but wanted to know how people wanted this done. How do you handle this
> > > issue in the server? Seems confingure.in and associated files is the
> most
> > > reasonable way to fix this to me.
> >
> > Also; which driver manager are you using? I think Nick Gorham has been
> > working on this issue within unixODBC.
> >
> > Peter
>
>AFAIK there should be nothing wrong with
>
>typedef Int4 int
>
>instead of the
>
>typedef Int4 long
>
>which is plainly wrong on 64 bit platforms.

Of course, the C standard doesn't say anything about the sizes of any of
the int-like datatypes, it only specifies their relative sizes. MySQL
(don't throw stones) addresses the problem like this in configure.in:

-------------------------------------------

AC_CHECK_SIZEOF(int, 4)
if test "$ac_cv_sizeof_int" -eq 0
then
AC_MSG_ERROR("No size for int type.")
fi
AC_CHECK_SIZEOF(long, 4)
if test "$ac_cv_sizeof_long" -eq 0
then
AC_MSG_ERROR("No size for long type.")
fi
AC_CHECK_SIZEOF(long long, 8)
if test "$ac_cv_sizeof_long_long" -eq 0
then
AC_MSG_ERROR("MySQL needs a long long type.")
fi
# off_t is not a builtin type
MYSQL_CHECK_SIZEOF(off_t, 4)
if test "$ac_cv_sizeof_off_t" -eq 0
then
AC_MSG_ERROR("MySQL needs a off_t type.")
fi

-------------------------------------------

Coupled with a few SIZEOF_<datatype> checks in the headers which set up the
typedefs for sized data, the problem is solved generically.

-- Andrew Bell
acbell(at)iastate(dot)edu

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2001-12-20 17:12:55 Re: Thoughts on the location of configuration files, how about this:
Previous Message Tom Lane 2001-12-20 15:42:41 Re: tkConfig.sh vs. ./configure