replica nfl jerseysreplica nfl jerseyssoccer jerseyreplica nfl jerseys forums.silverfrost.com :: View topic - Import in 7.1
forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Import in 7.1

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
davidb



Joined: 17 Jul 2009
Posts: 560
Location: UK

PostPosted: Fri Jun 13, 2014 8:36 am    Post subject: Import in 7.1 Reply with quote

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
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 8210
Location: Salford, UK

PostPosted: Fri Jun 13, 2014 3:50 pm    Post subject: Reply with quote

My intention was to implement IMPORT. If there are any deficiencies then please let me know.
Back to top
View user's profile Send private message AIM Address
davidb



Joined: 17 Jul 2009
Posts: 560
Location: UK

PostPosted: Fri Jun 13, 2014 5:24 pm    Post subject: Reply with quote

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
View user's profile Send private message
davidb



Joined: 17 Jul 2009
Posts: 560
Location: UK

PostPosted: Sat Aug 09, 2014 8:30 pm    Post subject: Reply with quote

Success!

Standard extension
The code below works with the IMPORT statement and /F2K enabled in Version 7.10 Smile

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
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 8210
Location: Salford, UK

PostPosted: Sun Aug 10, 2014 8:49 am    Post subject: Reply with quote

Thanks. I have logged this for further investigation.
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
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