View Single Post
  #4 (permalink)  
Old 10-10-2005, 02:11 PM
Herman D. Knoble
Guest
 
Posts: n/a
Default Re: warning about redundant lines of code

Someone suggested a compiler with XREF. I believe that FLINT may do this:
Cleanscape FortranLint:
http://www.cleanscape.net/products/f..._features.html

"...symbol cross-reference information to show all code references to any
symbol in the analyzed program,..."


Skip Knoble

On 9 Oct 2005 09:49:10 -0700, beliavsky@aol.com wrote:

-|Sometimes I inadvertently set the value of a variable but do not use it
-|before it is reset to another value, so that the initial statement
-|setting the variable is redundant. A trivial example is below.
-|
-|implicit none
-|integer :: i
-|i = 1 ! line has no effect
-|i = 2
-|print*,i
-|end
-|
-|Are there any compilers that warn about such a redundant line? Do you
-|think it would be useful to get such warnings? In a realistic example,
-|there may be many lines of code separating the statements setting 'i',
-|so the redundant code may be hard for the programmer to spot.
-|
-|One difficulty is that it may be impossible to say if a statement
-|setting a variable to an expression involving a non-PURE function is
-|redundant.

Reply With Quote