I have seen several posts showing how to use parenthesis for valid uses such as passing a variable by value and forcing a variable to be used as an expression in in an ASSOCIATE and so on … all valid uses but I would just like to caution that compilers have a lot of bugs (or sometimes “extensions”) regarding parenthesis. Just as one example (based on some real code) and three compilers …
program testit
complex :: c1, c2
real,parameter :: r1=20.0, r2=30.0
c1=10.0
c2=-10.0
write(*,*)(c1*r2,0.0)
write(*,*)(r1*r2,0.0)
write(*,*)(r1,r2)
end program testit
(base) urbanjs@venus:/tmp$ gfortran xx.f90&&./a.out
xx.f90:6:17:
6 | write(*,*)(c1*r2,0.0)
| 1
Error: Expected a right parenthesis in expression at (1)
xx.f90:7:17:
7 | write(*,*)(r1*r2,0.0)
| 1
Error: Expected a right parenthesis in expression at (1)
(base) urbanjs@venus:/tmp$ ifort xx.f90&&./a.out
(300.0000,0.0000000E+00) 0.0000000E+00
600.0000 0.0000000E+00
(20.00000,30.00000)
(base) urbanjs@venus:/tmp$ nvfortran xx.f90&&./a.out
(300.0000,0.000000) 0.000000
600.0000 0.000000
20.00000 30.00000
complex constants are involved in the most common non-standard behaviors.