Dear Mr Brainerd
Thanks for your reply and time
I use F 20030323 and mingw 3.2, OS is W98.
I have compiled the code attacched ( panei.f95 ) obtaining
Entity in OPTIONAL statement is not a procedure : Y
I apologize but can' t compile the code.
Regards
Giuseppe
----- Original Message -----
From: "Walt Brainerd" <[log in to unmask]>
To: <[log in to unmask]>
Sent: Friday 18 April 2003 4:29 AM
Subject: Re: Problem with optional in F
> The bug has been fixed in the latest version.
> I think I sent you a revised version of fcomp as
> an e-mail attachment when you complained about this
> previously (or maybe you didn't get it or maybe it
> was somebody else). Anyway, in the current version,
> this is not a problem.
>
> There are a couple of things wrong with this (as
> others have pointed out):
>
> 1. You are calling a function as a subroutine. This
> is not legal Fortran.
>
> 2. You have WRITE statements in a function (not legal
> F, as others have pointed out).
>
> With these things fixed, it works on the current version.
>
> One of the odd things about F is that I can fix bugs and
> make new versions available quickly. The downside is that
> I sort of let the "users" test it out. So when reporting
> possible bugs, it is really important to indicate the
> version that is being used (F -V).
>
> BTW, F allows a PRINT * statement in a function as a
> debugging aid, the only thing not allowed in a pure
> function (I think).
>
> [walt@localhost TEST]$ cat panei.f95
> module mod1
> public :: mia
> contains
> function mia (x,y) result (ff)
> real ,intent(in)::x
> real ::ff
> real ,intent(in),optional ::y
> if (present(y)) then
> ! write (unit=*,fmt=*) " x e y ",x,y
> print *, " x e y ",x,y
> else
> ! write (unit=*,fmt=*) " solo x ",x
> print *, " solo x ",x
> end if
> ff=x
> return
> end function mia
> end module mod1
>
>
> program tt
> use mod1
> implicit none
> real ::x,y
> x=1.234
> y=2.0*x
> y= mia (x)
> ! call mia (x,y)
> write (unit=*,fmt=*) y
> stop
> end program tt
> [walt@localhost TEST]$ F !$
> F panei.f95
> [walt@localhost TEST]$ ./a.out
> solo x 1.2340000
> 1.2340000
> [walt@localhost TEST]$ F -V
> Fortran Company/NAG F compiler Release 20030323
> Copyright (c) 1990-2003 The Fortran Company & The Numerical Algorithms
> Group Ltd.
>
>
> Giuseppe Panei wrote:
> > Hello
> >
> > I am learning F95 with free download F.
> > While I am searching a book can somebody
> > help me?
> > I don' t succeed to compile this simple code
> >
> > module mod1
> > public :: mia
> > contains
> > function mia (x,y) result (ff)
> > real ,intent(in)::x
> > real ::ff
> > real ,intent(in),optional ::y
> > if (present(y)) then
> > write (unit=*,fmt=*) " x e y ",x,y
> > else
> > write (unit=*,fmt=*) " solo x ",x
> > end if
> > ff=x
> > return
> > end function mia
> > end module mod1
> >
> >
> > program tt
> > use mod1
> > implicit none
> > real ::x,y
> > x=1.234
> > y=2.0*x
> > y= mia (x)
> > ! call mia (x,y)
> > write (unit=*,fmt=*) y
> > stop
> > end program tt
> >
> > The compiler yields an error at line:
> > real ,intent(in),optional ::y
> > "Entity in OPTIONAL statements is not a procedure: Y"
> >
> > I don' t understand where is the mistake.
> >
> > Thank in advance
> > GIuseppe
> >
> >
> >
> >
> >
> >
> > ing Giuseppe Panei
> >
> >
> >
> > S.G.A.I. srl di E. Forlani & c
> >
> > Studio di Geologia Applicata e Ingegneria srl
> >
> >
> >
> > Tel 39 0541 988277
> >
> > Fax 39 0541 987606
> >
> > e-mail [log in to unmask] <mailto:[log in to unmask]>
> >
> > web http://www.sgai.com/
> >
> >
> >
> > via Mariotti 20
> >
> > 47833 Morciano di Romagna (RN)
> >
> > ITALY
> >
> >
> >
> >
> >
>
>
> --
> Walt Brainerd +1-877-355-6640 (voice & fax)
> The Fortran Company +1-520-760-1397 (outside USA)
> 6025 N. Wilmot Road [log in to unmask]
> Tucson, AZ 85750 USA http://www.fortran.com
|