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

peter green <[email protected]>
Newsgroups gmane.linux.debian.ports.powerpc,gmane.linux.debian.ports.arm,gmane.linux.debian.ports.s390,gmane.linux.debian.ports.mips
Message-ID <[email protected]>
On 27/09/15 09:05, Edmund Grimley Evans wrote:
> peter green<[email protected]>:
>
>    
>>  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;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.