[mesa-users] Inline Comments in Namelists
Josiah Schwab
jwschwab at berkeley.edu
Thu May 7 19:22:14 EDT 2015
Hi All,
Did you know that inline comments in namelists are treated differently
than in the body of a program in a compiler-dependent way? I didn't!
For example, in a fortran program an assignment of the form
val = 3.14!2.78
obviously assigns the value 3.14 to the variable val.
If you write the same thing in a fortran namelist (an inlist),
+ with ifort, it behaves as you would naively expect
+ with gfortran, whole line is is effectively ignored
I've attached a trivial test program that demonstrates this.
GNU Fortran (GCC) 4.9.3 20141212 (prerelease)
,----
| henyey: ~$ gfortran -o test.x test_namelist.f90 && ./test.x
|
| assign: val = 3.14
| namelist: val = -1.00
`----
ifort (IFORT) 14.0.2 20140120
,----
| henyey: ~$ ifort -o test.x test_namelist.f90 && ./test.x
|
| assign: val = 3.14
| namelist: val = 3.14
`----
I spent a while today chasing a problem that boiled down to this
peculiarity. I figured I'd send a mail so that someday someone will
think of this more quickly than I did.
I tried looking up the standard, but couldn't find anything specific
enough to tell whether this behavior is specified or undefined.
Best,
Josiah
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_namelist.tar.gz
Type: application/octet-stream
Size: 435 bytes
Desc: not available
URL: <https://lists.mesastar.org/pipermail/mesa-users/attachments/20150507/ad14b16c/attachment.obj>
More information about the Mesa-users
mailing list