View previous topic :: View next topic |
Author |
Message |
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2393 Location: Yateley, Hants, UK
|
Posted: Mon Aug 07, 2023 2:22 pm Post subject: Probably the most wrong thing in a Fortran book ... |
|
|
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 |
|
Back to top |
|
|
JohnCampbell
Joined: 16 Feb 2006 Posts: 2580 Location: Sydney
|
Posted: Tue Aug 08, 2023 6:36 am Post subject: |
|
|
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 REAL*8 and INTEGER*4 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. |
|
Back to top |
|
|
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2393 Location: Yateley, Hants, UK
|
Posted: Tue Aug 08, 2023 9:24 am Post subject: |
|
|
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 |
|
Back to top |
|
|
JohnCampbell
Joined: 16 Feb 2006 Posts: 2580 Location: Sydney
|
Posted: Thu Aug 10, 2023 4:32 am Post subject: Re: |
|
|
LitusSaxonicum wrote: | 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 ? |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8011 Location: Salford, UK
|
Posted: Thu Aug 10, 2023 7:41 am Post subject: |
|
|
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. |
|
Back to top |
|
|
|