- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
With IFORT (Intel® Fortran Compiler Classic 2021.12.0 [Intel(R) 64]) the variables declared local to the block cannot be seen by the debugger.
So I switched to IFX (Intel® Fortran Compiler 2025.2.1 [Intel(R) 64]) and now they can be seen. But the local variables declared outside the block are now invisible!
Attached files replicate the problem with IFX. The use of an include file triggers the issue.
Link kopiert
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
You win some - you lose some.
As a hack
block
associate(VariableOfInterest_=>VariableOfInterest)
real :: blockLocalVariable
...
end associate
end blockJim Dempsey
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
Jim:
Why would you use a block?
It is like starting a fire with a match when someone has a torch.
JMN
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
You would use one because they can be quite useful and they exist!
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
Think of a BLOCK as an inline contained subroutine complete with its own local variable declarations yet within the scope of the procedure containing the block.
Jim Dempsey
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
The c language and most others allow variables to be declared when needed anywhere within your statements.
Fortran restricts us to declare all variables before any statements. I am not sure why Fortran has always had this restriction. Has there been proposals to change the standard in this area? I cant imagine it would affect performance but would greatly improve the coding experience.
A Fortran BLOCK allows you to create new variables almost anywhere. Its not as nice or as flexible as c.
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
Accepting all that is said, I like a nice subroutine name such as
INPUT
LOAD
ANALYSIS
EIGENVALUES
OUTPUT
- RSS-Feed abonnieren
- Thema als neu kennzeichnen
- Thema als gelesen kennzeichnen
- Diesen Thema für aktuellen Benutzer floaten
- Lesezeichen
- Abonnieren
- Drucker-Anzeigeseite