pure/impure issue...
From: Bart Vandewoestyne (MyFirstName.MyLastName_at_telenet.be)
Date: 03/24/05
- Next message: beliavsky_at_aol.com: "Re: Source code obfuscation"
- Previous message: Paul Van Delst: "Re: Source code obfuscation"
- Next in thread: Richard E Maine: "Re: pure/impure issue..."
- Reply: Richard E Maine: "Re: pure/impure issue..."
- Reply: Kevin G. Rhoads: "Re: pure/impure issue..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 24 Mar 2005 16:01:59 +0000 (UTC)
I'm having a situation like this, where I declare a function and inside
the function I'm calling the random_number intrinsic:
program test_pure
implicit none
contains
function f(x) result(y)
real, intent(in) :: x
real :: y
call random_number(x)
y = x
end function f
end program test_pure
Now i try to stick with F-syntax, and when I compile this, i get:
Error: test_pure.f95, line 11: Reference to impure subroutine RANDOM_NUMBER from pure procedure F
I really need random numbers, but it would also be nice to keep my f(x) as a
function and not change it to a subroutine.
Is there a way to create functions that call the random_number intrinsic in
their body? I would really like to keep my function, because if I change f(x),
this has consequences for other functions that call f(x), which i then will
also have to change to subroutines and so on and so on...
Regards,
Bart
-- "Share what you know. Learn what you don't."
- Next message: beliavsky_at_aol.com: "Re: Source code obfuscation"
- Previous message: Paul Van Delst: "Re: Source code obfuscation"
- Next in thread: Richard E Maine: "Re: pure/impure issue..."
- Reply: Richard E Maine: "Re: pure/impure issue..."
- Reply: Kevin G. Rhoads: "Re: pure/impure issue..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|