Where to put `implicit none` in Fortran

The implicit statement (including implicit none) applies to a scoping unit. Such a thing is defined as BLOCK construct, derived-type definition, interface body, program unit, or subprogram, excluding all nested scoping units in it This “excluding all nested scoping units in it” suggests that it may be necessary/desirable to have implicit none in each function … Read more

What does “real*8” mean?

As indicated in comments, real*8 isn’t standard Fortran. This FAQ entry has more details. That said, once we’re into the non-standard realm… The 8 refers to the number of bytes that the data type uses. So a 32-bit integer is integer*4 along the same lines. (But is also non-standard.) A quick search found this guide … Read more

Arrays of pointers

Yeah, pointer arrays are funny in Fortran. The problem is that this: TYPE(domain),DIMENSION(:),POINTER :: dom does not define an array of pointers, as you might think, but a pointer to an array. There’s a number of cool things you can do with these things in Fortran – pointing to slices of large arrays, even with … Read more

Fortran intent(inout) versus omitting intent

According to The Fortran 2003 Handbook by Adams, et al., there is one difference between an intent(inout) argument and argument without specified intent. The actual argument (i.e., in the caller) in the intent(inout) case must always be definable. If the intent is not specified, the argument must be definable if execution of the subroutine attempts … Read more

How to build i686-linux-android-gfortran for android-ndk8b (x86 arch Android)?

From https://groups.google.com/forum/#!msg/android-ndk/QR1qiN0jIpE/g0MHkhTd4YMJ as selalerer suggested. I didn’t try this, so I’m posting as a community wiki for reference purposes. Fortran for x86 Android ================= The guide is based on this one, many thanks to Phil: Compiling Android NDK with Objective-C-enabled gcc errors 1) Download and unpack Android NDK ‘android-ndk-r8c’, (the older -r8b NDK won’t work … Read more