Changes between Version 16 and Version 17 of HowTo/FortranStandards


Ignore:
Timestamp:
2013-04-30T10:36:07+02:00 (11 years ago)
Author:
mmcgrath
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • HowTo/FortranStandards

    v16 v17  
    146146'''IF''' bavard '''=>''' 2 then entering and leaving subroutines are reported  
    147147 
     148[[BR]]  
     149 
     150(2) If you are using an IF...ELSEIF....ENDIF loop, always make sure you include an ELSE statement at the end to catch any situation not covered in the other cases.  This should be done even if the ELSE statement doesn't do anything, just so that other people know that nothing needs to be done in some cases.  Too many bugs are found because an IF statement is not triggered due to something the programmer didn't think of.  This is especially problematic when the  programmer thinks to him/herself, "This value will always be in this range, so I don't have to consider other possibilities"...and then one day things change. 
     151 
     152{{{ 
     153 
     154IF()THEN 
     155  ! do something 
     156  blah 
     157ELSEIF()THEN 
     158  ! do something else 
     159  blah blah 
     160ELSE 
     161  ! do something, or not, but at least you should be aware of the possibility 
     162ENDIF 
     163 
     164}}} 
     165 
     166[[BR]]  
     167 
     168(3)  No compiler will catch all your bugs.  Always use multiple compilers to check, including all the error flags.  For example, I first compile locally with " gfortran -c -cpp -O0 -pg -g -Wall -ffpe-trap=invalid,zero -fbacktrace -fcheck=all -fbounds-check -pedantic".  Then I compile on asterix with "ifort -c -cpp -g -O0 -debug -fpe0 -ftrapuv -traceback".  I'm hoping to do it on Curie soon, too, since they have the NAG compiler there with is good with error checking.