Silverfrost Forums

Welcome to our forums

Probably the most wrong thing in a Fortran book ...

7 Aug 2023 1:22 #30498

In: 'Mastering Fortran, A Comprehensive Guide to Programming in Fortran', the authoress Sarah Johnson tells us that an EXTERNAL subroutine or function is one that resides in a different source code file (presumably not the one with the PROGRAM routine).

Do I guess from the above that Ms Johnson has never used EXTERNAL? I have to admit that I had not until I started using ClearWin !

Can anyone cap that?

Eddie

8 Aug 2023 5:36 #30499

Hi Eddie,

When was this published ?

Well, perhaps she learnt her Fortran from using Ifort, or has only used subroutines that were in the CONTAINS section of the PROGRAM. Unfortunately, she has not learnt EXTERNAL from the/any Fortran standard.

Mind you, many of us know the Fortran we like to use, me the one where REAL8 and INTEGER4 is included. ( much easier to read than REAL(2) or INTEGER(3) or INTEGER(4) ! )

Also, FTN95 does apply some strange assumptions regarding EXTERNAL, especially when debugging incorrect Fortran code.

8 Aug 2023 8:24 #30500

Hi John,

I have the Kindle edition, published 21 Feb 2023. The 'cover' (because Kindle books don't really have a cover) has '2023' on it in a large font. To be fair, I found some of the descriptions interesting until I came across the EXTERNAL stuff.

I'd love to know what the 'strange assumptions' of FTN95 are.

Eddie

10 Aug 2023 3:32 #30501

Quoted from LitusSaxonicum I'd love to know what the 'strange assumptions' of FTN95 are.

When writing new code and if you fail to declare an array and don't use /Implicit_none, then the arrays have the EXTERNAL function attribute and the compile might not report the error. It has been so long since I (wrote code with errors; NO) wrote code without /Implicit_none.

Actually, when writing new code, does Plato have an option of a pop-up list of variables in use in the current procedure, to select and paste into the code being written ?

Could this be an option, especially with long variable names ? Perhaps an alternative option for local variable name list or module variable list or only names already used in this routine, to limit the list length ?

10 Aug 2023 6:41 #30502

Fortran uses round brackets for both arrays and subprograms so f(i,j) could be an element of an array f or a call to a function f.

At the moment Plato does not provide a list of variables but I have a mind to add this at some point.

In Plato:

  1. Ctrl+G provides access to a list of your subprograms in the current file.
  2. Ctrl+Space provides an auto-complete for standard intrinsics.
  3. Ctrl+Shift+Space provides an auto-complete for standard constructs.
  4. Open bracket after the name of a standard intrinsic gives a list of the arguments.
Please login to reply.