Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!uunet!world!burley From: burley@world.std.com (James C Burley) Newsgroups: comp.lang.fortran Subject: Re: passing DIMs via COMMON?? Message-ID: Date: 11 Oct 90 07:03:05 GMT References: Sender: burley@world.std.com (James C Burley) Distribution: comp Organization: The World Lines: 54 In-Reply-To: martin@slsiris.harvard.edu's message of 9 Oct 90 15:11:40 GMT In article martin@slsiris.harvard.edu (Mr. Science) writes: Ive noticed that when I try to specify LUNs or adjustable array parameters by passing the value in a common block, f77 doesnt know what to do. For example, I want to specify all "magic numbers" (LUNs, array DIMs...) in the main program section to simplify code maintenance. If I try to pass array dimensions via a common block, the compiler complains about an "adjustable array dimension error"; if I pass these values in the subroutine call, however, the program executes as expected. To simplify the code, I would prefer not passing these values for each subroutine call. .................................................................... Patrick Martin Martin@SLSVAX.Harvard.Edu Martin@SLSIRIS.Harvard.Edu Disclaimer: I get taxed too high to afford an opinion. .................................................................... Could you post a reduced example of what you're trying to do with LUNs or arrays that isn't working? Meanwhile, I tried sending you an answer twice but some mail daemon rejected it, so here is my attempt to address the array issue: Make sure you are passing the arrays themselves as dummies; you can not put adjustable arrays in common areas. However, if you are doing this right, and the compiler accepts a subroutine whose dummy arguments include not only an adjustable array but all the variables that dimension the array, but does not accept a subroutine where some or all of the variables that dimension a dummy array are in a common area known to the subroutine, then I think the compiler is broken. I.e. you should be able to do both SUBROUTINE X(A,N) INTEGER A(N) ... and SUBROUTINE X(A) INTEGER A(N) COMMON /FOO/N ... This is, I believe, standard for ANSI 77. Whether a particular implementation (such as f77) supports it is another issue! James Craig Burley, Software Craftsperson burley@world.std.com