- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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 Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You win some - you lose some.
As a hack
block
associate(VariableOfInterest_=>VariableOfInterest)
real :: blockLocalVariable
...
end associate
end blockJim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jim:
Why would you use a block?
It is like starting a fire with a match when someone has a torch.
JMN
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You would use one because they can be quite useful and they exist!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Accepting all that is said, I like a nice subroutine name such as
INPUT
LOAD
ANALYSIS
EIGENVALUES
OUTPUT
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page