Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!ubiquity From: ubiquity@cs.utexas.edu (Richard Hoffman) Newsgroups: comp.lang.fortran Subject: Re: EQUIVALENCE or STRUCTURE/RECORD ? Summary: Try COMMON Message-ID: <16738@cs.utexas.edu> Date: 10 Jan 91 14:09:49 GMT References: <6683.278c85d2@cc.curtin.edu.au> Organization: Ubiquitous Productions, R. Hoffman Proprietor Lines: 27 In article <6683.278c85d2@cc.curtin.edu.au> Gumley_LE@cc.curtin.edu.au (Liam Gumley) writes: >The VAX compiler gives an error at the equivalence line [when you try >to use EQUIVALENCE with a formal paramter]. Now I know I could >do the equivalence in the main program and pass 'data' to the subprogram, >but I would like to do it in the subroutine if I can. Can I do this using >structure and record statements, or some other way? I never have understood why you can't equivalence formal parameters, but most FORTRAN compilers won't let you. One workaround is to not pass buffer formally at all, but use labelled COMMON instead. For example: C Main program BYTE BUFFER(100) COMMON /X/ BUFFER C Subroutine INTEGER*4 DATA(20) COMMON /X/ DATA This may not be appropriate in all cases. -- Richard Hoffman IBM Entry Systems Division (512) 823-1822 1529 Ben Crenshaw Way Austin, TX 78746 "Life is a gamble at terrible odds; (512) 327-9232 if it were a bet you wouldn't take it" (Tom Stoppard)