Re: using the value of a passed by reference variable (g77)
- From: Gib Bogle <bogle@xxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 06 Jul 2005 18:47:05 +1200
laurel wrote:
Hello all,
I have what I believe is a fairly simple problem, but I have not been able to find a solution on the boards or elsewhere.
I have a simplified program that has two variables (var1 and var2) that have been passed in by reference from IDL. I am working on a 64-bit sun machine with g77 as my compiler. var1 goes on to bigger and better things in another program, and that part works just fine. However, I would like to print the value of var2 and use it in my simple code. My code looks something like this:
********************************* subroutine simple(argc,argv) implicit none integer*4 argc real*8 argv(2),var1,var2
call another_subroutine(%val(argv(1))) print*,argv(2)
IF (var2 lt. 55) THEN *do something* END IF
end *********************************
Let's say that var2 had a value of 32 in IDL when it was passed into 'simple'. When I use the above command to print it in fortran I get a value of something like 2.12288063E-314. If I use print*,var2 I get another strange number like -2.14749086E+09 that is also not 32. I am assuming that these numbers are a numerical representation of the reference place of var2, but I just want to be able to get plain old 32 and do stuff with it.
If this is a common question on the board, could you please point me to the relevant thread(s). If not, then suggestions and examples of how to do this would be most welcome.
Thank you so much for your time, Laurel
In your code snippet var1 and var2 are both declared as real(8), but neither is given a value. If this is really what your code looks like then you are printing out uninitialized variables, and it isn't surprising that you see those strange values. What are you really trying to do?
Gib .
- References:
- Prev by Date: Re: IVF Standard and Professional differences
- Next by Date: Re: using the value of a passed by reference variable (g77)
- Previous by thread: using the value of a passed by reference variable (g77)
- Next by thread: Re: using the value of a passed by reference variable (g77)
- Index(es):
Relevant Pages
|