- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am trying to replace old Fortran language extensions in a large program with the corresponding featuresfrom the new Fortran 2003 standard (e.g. using DATE_AND_TIME instead of GETDAT or GETTIM from IFPORT). However, I am suprised to see that aprogram without the "USE IFPORT" statement still compiles and works properly with GETDAT or GETTIM procedures.I was expecting to see a complier error stating GETDAT or GETTIM procedures are not found.Is there a way to actually force IVF to produce such an error? I am relying onthese compiler errors to locatethese language extensions.
I am using IVF 11.1.067 with VS 2005 Professional.
Thanks for any help in advance,
Jon
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Those you cited aren't actually compiler extensions. They do rely on ifport library, so you might turn them into link errors by appending /link /nodefaultlib:libifport.lib to your link step.
By the way, date_and_time has been in the standard since f90.
By the way, date_and_time has been in the standard since f90.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When you use any functions or subroutines that are not intrinsic, providing interfaces (through USE statements or explicitly) allows the compiler to check that the subroutines/functions are called with the correct number and types of arguments.
The following program, written under the mistaken assumption that GETDAT and GETTIM return strings in the format mm:dd:yyyy and hh:mm:ss.uu rather than a set of integer arguments, fails to compile when the IFPORT module is USEd, because the compiler can detect that the arguments are incorrect.
Without the USE IFPORT line, the program will be compiled and, depending on whether or not the misused routines are to be found in the default libraries, linked without error messages. However, the resulting program will abort with an access violation.
As Tim has already pointed out, using external functions and subroutines, whether provided by the user or the compiler vendor, does not constitute a "language extension", because the Fortran standard prescribes the rules for writing and using such functions and subroutines.
The following program, written under the mistaken assumption that GETDAT and GETTIM return strings in the format mm:dd:yyyy and hh:mm:ss.uu rather than a set of integer arguments, fails to compile when the IFPORT module is USEd, because the compiler can detect that the arguments are incorrect.
[fortran]program tst
use IFPORT
character*11 :: date1,time1
call getdat(date1)
call gettim(time1)
write(*,10)date1,time1
10 format(' Date : ',A,/,' Time : ',A)
end program tst
[/fortran]
Without the USE IFPORT line, the program will be compiled and, depending on whether or not the misused routines are to be found in the default libraries, linked without error messages. However, the resulting program will abort with an access violation.
As Tim has already pointed out, using external functions and subroutines, whether provided by the user or the compiler vendor, does not constitute a "language extension", because the Fortran standard prescribes the rules for writing and using such functions and subroutines.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Check if you have any of the following set to "Yes":
- Fortran/Libraries/Use Portlib library (/4Yportlib)
- Fortran/Compatibility/Use PowerStation compatibility library (/fpscomp:libs)
- Fortran/Diagnostics/Warn For Non-Standard Fortran to f95 or f2003 (/stand:f95, /stand:f03)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
While you could use gloabal find in files to find the occurances of GETDATand GETTIM, if you are preparing a library for use by others, you would like to give them a reminder that they should fix there code.
I imaging, that when you have such a library, you also require a
USE YourLibrary
In there you could declare an interface to GETDAT and GETTIM
type USE_DATE_AND_TIME
integer ::notUsed
end type USE_DATE_AND_TIME
interface
subroutine GETDAT(msg)
type(USE_DATE_AND_TIME) :: msg
end subroutine GETDAT
end interface
...
When they USE YourLibrary they will error out should they continue to use GETDAT...
Jim Dempsey
I imaging, that when you have such a library, you also require a
USE YourLibrary
In there you could declare an interface to GETDAT and GETTIM
type USE_DATE_AND_TIME
integer ::notUsed
end type USE_DATE_AND_TIME
interface
subroutine GETDAT(msg)
type(USE_DATE_AND_TIME) :: msg
end subroutine GETDAT
end interface
...
When they USE YourLibrary they will error out should they continue to use GETDAT...
Jim Dempsey

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page