[Coin-lpsolver] CLP on a 64 bit platform
Matthew Saltzman
mjs at ces.clemson.edu
Wed Aug 13 10:35:32 EDT 2003
On Wed, 13 Aug 2003, John J Forrest wrote:
> It should not be too difficult to port but you may need some help. Clp
> should work on all platforms and I will make sure it does.
>
>
> All my work on this will be on the "pre' development branch.
>
> For moment I have added some tests such as #ifdef INT_IS_8 - does anyone
> know if there is a automatic compiler flag like __64BIT__?
I don't think there's any direct, portable way to determine the size of an
int type at preprocessor time.
The portable C++-ish thing to do is #include <limits> and test
numeric_limits<> traits (see, e.g., Stroustrup, Sec. 22.2). These are
obviously not available at preprocessor time.
The portable C-ish thing to do is #include <climits> and test values of
CHAR_BITS, UCHAR_MAX, USHRT_MAX, UINT_MAX, ULONG_MAX, and ULLONG_MAX. It
doesn't seem that you can use sizeof() in a preprocessor directive. For
float types, #include <cfloat> and test appropriate values.
gcc does provide __WORDSIZE, but that's surely not portable to anything
else (and it doesn't really address the question anyway--__WORDSIZE is
the number of bits in a long).
>
> For CoinFactorization I have used #ifdef. In some other places I have
> changed code so it "may" be correct while in other cases I have taken out
> asserts - however you will lose a bit of memory for now as only 32 bits of
> 64 will be used. This can be fixed later.
>
> Does anyone know if I can force int to be treated as long on AIX? Then I
> could debug it there.
The gcc compiler (v3.2 or higher anyway) has a command line option
-nint64, which forces 64-bit ints and longs. There are options that
produce other combinations for int types, float types, and pointer types
as well. I haven't tried these out.
--
Matthew Saltzman
Clemson University Math Sciences
mjs at clemson.edu
http://www.math.clemson.edu/~mjs
More information about the Clp
mailing list