Re: Q: ENTRY Argument List
From: Gary L. Scott (garyscott_at_ev1.net)
Date: 03/22/04
- Next message: Walt Brainerd: "Re: A petition to J3 apropos FORTRAN's future"
- Previous message: Richard Maine: "Re: [ifc] print iterations only on one line..."
- In reply to: Gary L. Scott: "Re: Q: ENTRY Argument List"
- Next in thread: glen herrmannsfeldt: "Re: Q: ENTRY Argument List"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 21 Mar 2004 17:51:32 -0600
"Gary L. Scott" wrote:
>
> Richard Maine wrote:
> >
> > "Gary L. Scott" <garyscott@ev1.net> writes:
> >
> > > Must entry
> > > statement argument list types/sizes match the enclosing subroutine's
> > > argument list?
> >
> > Um. Depends on exactly what you mean. There is only one
> > declaration for each name in a procedure (dummy argument or any other).
> > So there is no way for the same name to have two different declarations.
> > That isn't a restriction related to entry - there just isn't even a
> > syntax to say that a name has 2 definitions depending on how you
> > entered. So you can't have something like
> >
> > subroutine sub(x)
> > real x
> > entry e(x)
> > integer x
> >
> > That would just be 2 conflicting declarations for x - not one for
> > each entry.
> >
> > However, the argument lists for different entries don't have to
> > have anything in particular in common. They could have completely
> > different dummies, or the same dummies in different orders.
> >
> > You do have to make sure that you don't reference an unassociated
> > dummy. Dummies do *NOT* retain their association between calls;
> > the only dummies you can work with are the ones in the entry
> > that you came through. Ssome compilers have been known to allow
> > tricks here, but they are not standard and do *NOT* work with
> > other compilers.
>
> I knew I wasn't being specific enough. I have never had a problem with
> other than the one compiler, I just continue to have a sinking feeling
> that I'm courting disaster whenever I use entry. It's a 20 year old
> memory, but what I seem to remember not working with one early version
> of VOS F77 was:
>
> subroutine one(integer1, integer2, integer3)
>
> character*80 char1
> integer*3 integer1, integer2, integer3
>
> entry two(integer1, char1)
>
> ...
>
> end subroutine
For the record, I usually use "character(*)" for argument declarations.
In the above referenced code, I always included an argument containing
the number of characters actually passed.
>
> If I called entry TWO with an integer*3 variable and a (say 10
> character) text string, the text string data would not be passed
> correctly (don't remember if I determined exactly what the values were
> but I think it only filled the first 3 characters of the string).
>
> Anyway it appears that I can stop worrying.
>
> >
> > --
> > Richard Maine
> > email: my last name at domain
> > domain: sumertriangle dot net
>
> --
>
> Gary Scott
> mailto:garyscott@ev1.net
>
> Fortran Library: http://www.fortranlib.com
>
> Support the Original G95 Project: http://www.g95.org
> -OR-
> Support the GNU GFortran Project: http://gcc.gnu.org/fortran/index.html
>
> Why are there two? God only knows.
>
> Democracy is two wolves and a sheep, voting on what to eat for dinner...
> Liberty is a well armed sheep contesting the vote. - Thomas Jefferson
-- Gary Scott mailto:garyscott@ev1.net Fortran Library: http://www.fortranlib.com Support the Original G95 Project: http://www.g95.org -OR- Support the GNU GFortran Project: http://gcc.gnu.org/fortran/index.html Why are there two? God only knows. Democracy is two wolves and a sheep, voting on what to eat for dinner... Liberty is a well armed sheep contesting the vote. - Thomas Jefferson
- Next message: Walt Brainerd: "Re: A petition to J3 apropos FORTRAN's future"
- Previous message: Richard Maine: "Re: [ifc] print iterations only on one line..."
- In reply to: Gary L. Scott: "Re: Q: ENTRY Argument List"
- Next in thread: glen herrmannsfeldt: "Re: Q: ENTRY Argument List"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|