home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.fortran
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!uwm.edu!spool.mu.edu!sgiblab!sgigate!sgi!paradise.mti.sgi.com!rutt
- From: "John C. Ruttenberg" <rutt@paradise.mti.sgi.com>
- Subject: Obscure fortran question
- Message-ID: <tubetf0@sgi.sgi.com>
- Sender: rutt@paradise.mti.sgi.com
- Reply-To: rutt@paradise.mti.sgi.com
- Organization: Silicon Graphics, Inc. Mountain View, CA
- Date: Tue, 22 Dec 1992 22:22:49 GMT
- Lines: 42
-
-
-
- Suppose the do variable is assigned above the loop and used in the second
- expression of a do. Should its value there be:
-
- 1. Its value above the loop, or
-
- 2. The value of the first expression in the do?
-
- This is the same as the question of wheter the control variable and the final
- bound are initialized in parallel or serially. Looking at the standard, I was
- unable to decide what should happen.
-
- The SGI compiler seems to choose option 2. Here's a test that demonstrates
- this.
-
- count = 0
- i = 10
- do 240 i = 1, identity(i)
- 240 count = count + 1
- print *, count, i
- stop
- end
-
- integer function identity(i)
- integer i
-
- identity = i
-
- return
- end
-
- This prints:
-
- 1 2
-
- demonstrating that i had a value of 1 (not 10) at the time of the call to
- identify? Is this right?
-
-
-
-
-