On Fri, Jun 5, 2009 at 9:20 PM, David Bateman<address@hidden> wrote:
Why not just use
octave_idx_type if the fortran logical index is 8bit with --enable-64?
This is in the end what I did, but I declared a macro
octave_f77_bool_type defined as octave_idx_type.
The underlying assumption is that the Fortran compiler uses the same
amount of bytes for INTEGER and LOGICAL. I would prefer to "hide" this
assumption behind a macro since there might be some Fortran compilers
that handle things differently. (After all, it is quite wasteful to
allocate 8 bytes for a variable with only two states).
I looked a bit around how the different Fortran compilers handle the
size of LOGICALs. For gfortran (with and without -fdefault-integer-8)
and ifort (with and without -i8), the size of LOGICALs will always be
the size of INTEGER. However, with pgf90, the compiler option -i8,
leaves the size of LOGICALs to 4 bytes. Only the option -i8storage
allocates 8 bytes for INTEGER and LOGICAL.
This reminds me also a bit of the assumption that size of a pointer
will always be the same as the size of an int in C. Such assumption is
the classical problem when porting a program to 64-bit CPU.
Cheers,
Alex