For Programmers: Free Programming Magazines  


Home > Archive > Fortran > November 2005 > Re: TRIM









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: TRIM
Catherine Rees Lay

2005-11-18, 7:56 am

Ken Plotkin wrote:

> On Wed, 16 Nov 2005 13:33:01 +0000, Catherine Rees Lay
> <spamtrap@polyhedron.com> wrote:
>
>
>
>
>
> If you call a function, doesn't the calling program have to know the
> type of the function?
>
> I've blown things up more than enough times by forgetting to do that.
>
> Ken Plotkin
>

I think we're just using different words for the same thing...

PROGRAM MAIN

CALL SUB

END

SUBROUTINE SUB

INTEGER ANS, FUN

ANS = FUN(3)

END

INTEGER FUNCTION FUN(ARG)

INTEGER ARG

FUN = ARG*2

END

(Non I-N integer names used deliberately to force declarations, and
apologies for any typos)

The caller here is subroutine SUB which does indeed need to know the
type of the function - but the program is MAIN, and it doesn't.

Catherine.

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com