Boost logo

Ublas :

Subject: Re: [ublas] numeric-bindings: current issues on 64-bit platforms
From: Rutger ter Borg (rutger_at_[hidden])
Date: 2009-01-14 06:23:21


Thomas Klimpel wrote:
> BIND_FORTRAN_INTEGER_8
> BIND_FORTRAN_F2C_RETURN_CONVENTIONS
>
> #ifndef BIND_FORTRAN_INTEGER_8
> typedef int integer_t ;
> #else
> typedef std::ptrdiff_t integer_t ;
> #endif
>
[ snip ]
>However, something is still fishy, because the test-script produces the
>following output on a linux32 system:

It could be that you are seeing incorrect results on a 32-bit platform,
because ptrdiff_t may be 32 bit on a 32 bit platform,
whereas -fdefault-integer-8 is fixed at 64 bits.

I've tested a couple of other variants, these all yield correct results
using your supplied program on a x86-64 platform.

#ifndef BIND_FORTRAN_INTEGER_8
typedef int integer_t ;
#else
typedef std::tr1::int64_t integer_t ;
#endif

or

#ifndef BIND_FORTRAN_INTEGER_8
typedef int integer_t ;
#else
typedef boost::int64_t integer_t ;
#endif

or

#ifndef BIND_FORTRAN_INTEGER_8
typedef int integer_t ;
#else
typedef long integer_t ;
#endif

I'm probably in favour of an int64_t, because that's the exact definition
of -fdefault-integer-8

Cheers,

Rutger