Path: utzoo!censor!geac!torsqnt!jarvis.csri.toronto.edu!rutgers!mailrus!ames!skipper!elxsi!maine From: maine@elxsi.dfrf.nasa.gov (Richard Maine) Newsgroups: comp.lang.fortran Subject: Re: Implied do-loop statement, for the next FORTRAN? Message-ID: Date: 4 Mar 90 17:42:33 GMT References: <2044.25efa542@admdev.cut.oz> Sender: news@skipper.dfrf.nasa.gov Organization: NASA Dryden, Edwards, Cal. Lines: 40 In-reply-to: Clifton_RL@admdev.cut.oz's message of 3 Mar 90 03:06:41 GMT On 3 Mar 90 03:06:41 GMT, Clifton_RL@admdev.cut.oz said: Clifton> IMPLIED DO-LOOP STATEMENT Clifton> We could use the implied do-loop construction. For example: Clifton> (((C(I,J)=A(I,K)*B(K,J) ,K=1,M) ,I=1,M) ,J=1,M) Clifton> This clear statement would replace the familiar clutter of: Clifton> DO J etc Clifton> DO I etc Clifton> DO K etc Clifton> C(I,J)= etc Clifton> ENDDO Clifton> ENDDO Clifton> ENDDO Clifton> How about it? Its mostly just a matter of taste (which means others are sure to disagree), but I find the DO-ENDDO to be clearer than the implied DO construct you show. Longer, true, but I wouldn't call it cluttered. Perhaps it's just because I'm used to it. The real test comes when things get more complicated. You showed just about the simplest possible do loop. How about when you replace the inner core with something with multiple statements - perhaps a block if (or even something with statement labels and G*TO statements :-)). Or what happens when there are statements in some of the intermediate level DO's. Certainly you COULD write such things in an implied DO notation, but I think they will be very hard to read, particularly when the loop contents get large enough that the J=1,M or whatever is several lines below the first reference to the J. That would mean you could not read the code sequentially, but would have to scan ahead to figure out what this J thing was. Possible, but awkward. -- Richard Maine maine@elxsi.dfrf.nasa.gov [130.134.64.6]