From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.7 required=5.0 tests=BAYES_00,INVALID_DATE, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,4bd960829a3eda10 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1994-09-17 16:59:27 PST Path: bga.com!news.sprintlink.net!howland.reston.ans.net!swiss.ans.net!newsgate.watson.ibm.com!watnews.watson.ibm.com!ncohen From: ncohen@watson.ibm.com (Norman H. Cohen) Newsgroups: comp.lang.ada Subject: Fortran 90 arrays (was: Re: Ada9X Features) Date: 14 Sep 1994 13:06:05 GMT Organization: IBM T.J. Watson Research Center Distribution: world Message-ID: <356sft$oen@watnews1.watson.ibm.com> References: <9408127793.AA779382777@smtpgw.fnoc.navy.mil> <354iqm$1r4@felix.seas.gwu.edu> <3550l2$8o7@schonberg.cs.nyu.edu> Reply-To: ncohen@watson.ibm.com NNTP-Posting-Host: rios8.watson.ibm.com Date: 1994-09-14T13:06:05+00:00 List-Id: In article <3550l2$8o7@schonberg.cs.nyu.edu>, dewar@cs.nyu.edu (Robert Dewar) writes: |> Arrays in Fortran are passed by address only, and bounds information |> is not passed (note I am talking up through 77 here, who knows what they |> have wrought in 90 -- well probbaly some reader of this group does :-) |> Fortran 90 has "assumed shape arrays". If a dummy argument (that's Fortranese for formal parameter) named A is declared dimension(:,:)::A for example, it's a two dimensional assumed-shape array that gets its bounds from the actual argument. A subroutine with such an argument must be declared in an interface block--roughly analogous to an Ada subprogram or package declaration. That alerts the compiler to pass a descriptor for the array, containing bounds information, rather than just the address of the array. This preserves upward compatibility, because arrays can be passed to old-style subroutines by address, allowing the conventional Fortran overlay tricks to be used within those subroutines. There are intrinsic functions analogous to the Ada 'First(n) and 'Last(n) attributes. Fortran 90 also has "deferred shape arrays," analogous to values in access types designating unconstrained array subtypes. Such arrays are allocated dynamically by specifying their bounds in an Allocate statement. A conspicuous difference is that Fortran 90 pointers are dereferenced implicitly, like C++ references. Ada programmers will find a number of familiar terms and programming mechanisms in Fortran 90. Unfortunately, the correspondence between the terms and the mechanisms is not the same as in Ada. For example, Fortran 90 has record types, but they're called derived types! Fortran 90 has overloaded declarations, but they're called generic interfaces! -- Norman H. Cohen ncohen@watson.ibm.com