Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sdd.hp.com!spool.mu.edu!cs.umn.edu!uc!shamash!rrr From: rrr@u02.svl.cdc.com (Rich Ragan) Newsgroups: comp.lang.fortran Subject: Re: Fortran 90 status Message-ID: <32673@shamash.cdc.com> Date: 30 Apr 91 15:16:01 GMT Article-I.D.: shamash.32673 References: <1991Apr24.202115.16119@dragon.wpd.sgi.com> <1991Apr25.235111.26282@alchemy.chem.utoronto.ca> <1991Apr26.142249.21064@convex.com> <1991Apr29.140241.1@dev8n.mdcbbs.com> Sender: usenet@shamash.cdc.com Reply-To: rrr@svl.cdc.com Organization: Control Data Corporation, Silicon Valley Operations Lines: 33 In <1991Apr29.140241.1@dev8n.mdcbbs.com> campbell@dev8n.mdcbbs.com (Tim Campbell) writes: >Are you "in the know" on this one? Will Fortran 90 tell me if I try to pass >arguments to a subroutine which doesn't match the type of arguments expected? >More insight is appreciated. I owe you a beer (although I don't see myself >making it to a standards meeting anytime soon). Fortran 90 does include a procedure interface block so that you can say things like INTERFACE SUBROUTINE SWITCH (X, Y, Z) INTEGER, INTENT (IN) :: X REAL, INTENT (OUT) :: Y REAL, INTENT (INOUT) :: Z(10) END SUBROUTINE SWITCH END INTERFACE This gives the compiler the information necessary to do the kind of checking that you want. The INTENT declarations are new with Fortran 90 and let you specify if the dummy argument is read only, write only, or both. This form of interface declaration is intended for use with existing external subprograms and functions. If you were writing from scratch with Fortran 90, a better way to do this would be to build one or more MODULE subprograms containing your library routines. Then you would specify the use of a particular module when you needed its routines (e.g, string handling module) and the compiler could obtain the interface checking information directly from the module rather than you having to write explicit INTERFACE blocks. -- Richard R. Ragan rrr@svl.cdc.com (408) 496-4340 Control Data Corporation - Silicon Valley Operations 5101 Patrick Henry Drive, Santa Clara, CA 95054-1111