[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Mixing Fortran and C (on arm64, ppc64, ppc64el, mips64el and s390x)



On 27/09/15 09:05, Edmund Grimley Evans wrote:
peter green <plugwash@p10link.net>:

  
From the ppc64 build log (s390x was much the same).
    
Thank you for taking the trouble to look at the build logs; I just saw
that it was "Installed" and naively assumed it had worked!

Perhaps then the architectures for which "INTEGER" is "long" (or
whatever) really are exactly those architectures for which a pointer
is 64-bit. 

Umm, you seem to be reading things backwards.

#if defined(__alpha__) || defined(__sparc64__) || defined(__x86_64__) || defined(__ia64__)
typedef int integer;
typedef int logical;
#else
typedef long int integer;
typedef long int logical;
#endif

That code is defining "integer" and "logical" as "long" on most architectures but as "int" on a list of 64-bit architectures. My interpretation is that the code is trying to make "integer" and "logical" 32-bit on all systems.

If you only care about Debian and other modern systems you could probablly reduce the code to

typedef int integer;
typedef int logical;

Since int is 32-bit on all Debian architectures.
#include <stdint.h>
#if UINTPTR_MAX == UINT64_MAX

I think that last approach is required to work by the standards, while
__LP64__ is a GCC extension, though I might be wrong.
  
If my understanding of the intent of the ifdef is correct and you believe it's ok to rely on c99 stuff you may as well just do

#include <inttypes.h>
typedef int32_t integer;
typedef int32_t logical;



Reply to: