Richard E Maine wrote:
> On Sep 22, 2004, at 11:31 AM, Catherine Moroney wrote:
>
> > I tried to code something like an "i++" operator, but ran up
> > against the constraint that the input to any user-defined operator
> > has to be strictly intent(in). So, the value of the input argument
> > is never changed and i++ doesn't work. Is there any way around this?
>
> No. This is a pretty fundamental philosophical difference between
> C and Fortran. C is full of side effects. Fortran tends not to be.
> Fortran operators produce outputs; they don't modify their inputs.
>
> You can write an increment subroutine, but of course, you can't
> then call that subroutine in the middle of an expression.
Writing a function seems to work though. Or is there a problem with
this solution that I don't know?
>
> > Is the
> > 'USE MISC_UTILITY, ONLY: .PP' syntax ok?
>
> No. You need
>
> USE MISC_UTILITY, ONLY: operator(pp)
>
> --
> Richard Maine | Good judgment comes from experience;
> [log in to unmask] | experience comes from bad judgment.
> | -- Mark Twain
--
-------------------------------------------------------------------------
Catherine Moroney phone : (818) 393-3392
Jet Propulsion Laboratory fax : (818) 393-4802
MailStop 169-315 email : [log in to unmask]
4800 Oak Grove Drive
Pasadena, CA 91109-8099
|