Print

Print


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.
> 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