 |
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
davidb
Joined: 17 Jul 2009 Posts: 560 Location: UK
|
Posted: Fri Jun 13, 2014 8:36 am Post subject: Import in 7.1 |
|
|
In the list of changes for 7.1 there are the following items:
The IMPORT statement has been added as part of the Fortran 2003 standard.
The /ISO command line option previously did not generate an error report when a TYPE or PARAMETER within an INTERFACE was inherited from the host.
Can you conform whether the IMPORT statement is implemented, or if it is just allowed syntax but ignored?
The fact that an interface would inherit TYPE and PARAMETERS from its host meant that IMPORT was effectively the default in version 7.00. It is possible that you have utilised this and have fully implemented IMPORT.
However, there was some discussion here about just accepting the syntax but not do anything. _________________ Programmer in: Fortran 77/95/2003/2008, C, C++ (& OpenMP), java, Python, Perl |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8210 Location: Salford, UK
|
Posted: Fri Jun 13, 2014 3:50 pm Post subject: |
|
|
My intention was to implement IMPORT. If there are any deficiencies then please let me know. |
|
Back to top |
|
 |
davidb
Joined: 17 Jul 2009 Posts: 560 Location: UK
|
Posted: Fri Jun 13, 2014 5:24 pm Post subject: |
|
|
Thanks Paul.
I will try it out when I have time to do so. It is a useful extension to have I think. _________________ Programmer in: Fortran 77/95/2003/2008, C, C++ (& OpenMP), java, Python, Perl |
|
Back to top |
|
 |
davidb
Joined: 17 Jul 2009 Posts: 560 Location: UK
|
Posted: Sat Aug 09, 2014 8:30 pm Post subject: |
|
|
Success!
Standard extension
The code below works with the IMPORT statement and /F2K enabled in Version 7.10
Non standard extension
Note that as a non-standard extension you can still omit the import and parameter declaration lines and it does host association (i.e. it seems to import whatever it needs from the host to maintain linkage). It would have been nice to have a NON_STANDARD warning in such cases that could be switched off with /NON_STANDARD but I am happy with it as it is.
Note that using /ISO doesn't seem to produce the error message for this non-standard extension as indicated in the release notes.
David.
Code: |
module mod
integer, parameter :: dp = kind(1.0d0)
contains
subroutine test(fnc, x, y)
! Interface defining fnc dummay argument
interface
function fnc(x)
! F2000 extension needs /F2K
import dp
! F95 needs to redeclare dp as it isn't accessible by "host" association
! integer, parameter :: dp = kind(1.0d0)
real(kind=dp), intent(in) :: x
real(kind=dp) :: fnc
end function fnc
end interface
real(kind=dp), intent(in) :: x
real(kind=dp), intent(out) :: y
y = fnc(x)
end subroutine test
function fnc(x)
real(kind=dp), intent(in) :: x
real(kind=dp) :: fnc
fnc = x
end function fnc
end module mod
program anon
use mod
real(kind=dp) :: y
call test(fnc, 1.0d0, y)
print *, y, '<-- should print 1.0 and is!'
end program anon
|
_________________ Programmer in: Fortran 77/95/2003/2008, C, C++ (& OpenMP), java, Python, Perl |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8210 Location: Salford, UK
|
Posted: Sun Aug 10, 2014 8:49 am Post subject: |
|
|
Thanks. I have logged this for further investigation. |
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|