Hi
I have a simple question, is there a way to prevent the F90 compiler to check if the actual and formal arguments to a subroutine are different?
Before telling me that it is criminal to pass the wrong kind of variable please read my reason for the question.
The reason for this question is that I am trying to convert an old F77 package to F90 and one feature of this package was the use an integer workspace to store records with all kinds of variables, (integers, pointers to other records (which were integers), characters and reals). This F77 package was written long before typing become available with F90. The problem I have is that the package goes via subroutine calls to transfer such variables of different types into the integer wrkspace and in the old F77 compilers there were never any check that the actual and formal arguments were of the same type. Thus it was possible to write
integer iws(10000)
double precision xx,yy
...
call storr(iws(77),xx)
...
where the subroutine was
subroutine storr(x1,x2)
double precision x1,x2
x1=x2
return
end
which would transfer the bit pattern representing the real value of xx to (two) integer words, iws(77) and iws(78).
One could then get the value back by reversing the arguments
call storr(yy,iws(77))
and yy would have the value of xx
Apart from giving a very primitive way of having record structures a unique feature of this integer workspace was that one could easily write all that was stored in this integer workspce on an unformatted file and then read it back and continue working with the data stored.
It will be extremely difficult to do this with the datastructure I have in my current F90 code using typed records because the records can vary greatly in size and number.
So after this long introduction, is there a way to prevent the F90 compiler to generate an error if the actual and formal arguments to a subroutine are different?
Maybe I can ask a C programmer for help?
Bosse
I have a simple question, is there a way to prevent the F90 compiler to check if the actual and formal arguments to a subroutine are different?
Before telling me that it is criminal to pass the wrong kind of variable please read my reason for the question.
The reason for this question is that I am trying to convert an old F77 package to F90 and one feature of this package was the use an integer workspace to store records with all kinds of variables, (integers, pointers to other records (which were integers), characters and reals). This F77 package was written long before typing become available with F90. The problem I have is that the package goes via subroutine calls to transfer such variables of different types into the integer wrkspace and in the old F77 compilers there were never any check that the actual and formal arguments were of the same type. Thus it was possible to write
integer iws(10000)
double precision xx,yy
...
call storr(iws(77),xx)
...
where the subroutine was
subroutine storr(x1,x2)
double precision x1,x2
x1=x2
return
end
which would transfer the bit pattern representing the real value of xx to (two) integer words, iws(77) and iws(78).
One could then get the value back by reversing the arguments
call storr(yy,iws(77))
and yy would have the value of xx
Apart from giving a very primitive way of having record structures a unique feature of this integer workspace was that one could easily write all that was stored in this integer workspce on an unformatted file and then read it back and continue working with the data stored.
It will be extremely difficult to do this with the datastructure I have in my current F90 code using typed records because the records can vary greatly in size and number.
So after this long introduction, is there a way to prevent the F90 compiler to generate an error if the actual and formal arguments to a subroutine are different?
Maybe I can ask a C programmer for help?
Bosse