Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!ames!sdcsvax!ucbvax!drao.nrc.CDN!gac From: gac@drao.nrc.CDN.UUCP Newsgroups: comp.os.vms Subject: re: language question Message-ID: <58*gac@drao.nrc.cdn> Date: Mon, 25-May-87 17:42:34 EDT Article-I.D.: drao.58*gac Posted: Mon May 25 17:42:34 1987 Date-Received: Tue, 26-May-87 03:04:24 EDT Sender: daemon@ucbvax.BERKELEY.EDU Distribution: world Organization: The ARPA Internet Lines: 33 You will not be able to get away with that little overhead. An approach that does work is as follows: 1. In your calling program equivalence the array(s) to character strings and, in the subroutine calls pass the character string names, rather than the array names; 2. Write your subroutine as follows: subroutine foo ( c, type) character *(*) c ! array equivalence integer type ! type of array (real*4, int*2, etc ! **************** parameter maxlength = 200 character*maxlength ctmp real*4 rtmp(maxlength/4) integer*2 itmp(maxlength/2) equivalence( ctmp, rtmp, itmp) ctmp = c if (type .eq. 1) then ! real*4 ... else if (type .eq. 2) then ! integer*2 ... end if end There is, of course, a triple overhead: a string copy, a check on type and wasted space for the dummy character string. An alternative, which I prefer, is to do the local declarations above in a common block and do the string copy in the calling program, bu then, some people are alergic to global variables ... Geoff Croes