fortran - gfortran reports no compilation error when function variables are not declared -


this fortran 90 function have within main program. can see several variables types such zlams not declared @ top. gfortran 5.2 not report error whatsoever. if move code separate module , call function in main module undeclared variables report compilation error. why ?

real(kind=sp) function abctest (phis, lams, polphi, pollam) use k_parameters,only:&    sp  real(kind=sp)        lams,phis,polphi,pollam  data        zrpi18 , zpir18  / 57.2957795 , 0.0174532925 /  sinpol = sin(zpir18*polphi) cospol = cos(zpir18*polphi) zphis  = zpir18*phis zlams  = lams if(zlams.gt.180.0) zlams = zlams - 360.0 zlams  = zpir18*zlams arg     = cospol*cos(zphis)*cos(zlams) + sinpol*sin(zphis)  abctest = zrpi18*asin(arg)  return end function abctest 

you must use implicit none @ top of each compilation unit such error. otherwise, implicit typing rules in effect.

no other type of implicit statement except of implicit none recommended in modern fortran. should used in modern code.

each compilation unit means every external procedure, main program , each module or submodule. module procedures see module's implicit statement due host association. same holds internal procedures controlled host procedure's implicit statement.


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -