- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I have a legacy FORTRAN 77 code (*.f). I want to use some Fortran 90 features in it, e.g. module and dynamic memory allocation. Because it's too big to re-write everything in the standard Fortran 90 (*.f90), I'm wondering is it safe to incorporate the Fortran 90 features in a FORTRAN 77 code (*.f). For example,
[fxfortran] use global
real(kind=8), allocatable :: a(:)
allocate(a(10))
[/fxfortran] I clearly understand that this is the compiler dependent. Since I'm always using Intel Fortran Compiler (my signature), I want to ask the experts in Intel. I have tried some by using ifort, it works fine. But I'm not 100 percent sure about it.
Thanks!
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Maybe your concern is about compiler dependence.
real(kind=8) may be the most questionable. It's fairly safe to expect it to continue working with the successors of compilers for which it works now. People who use that usually call real*8 fortran 77, even though it isn't. If you search, you will find 1 or 2 currently maintained compilers where one or more of real*8 or real(8) doesn't work, where real(selected_real_kind(12)) does.
I suppose any compiler would correct you on the spelling of deallocate.
All such basic f90 features have been supported by every maintained compiler for at least 5 years. If the application works OK with a current compiler before you make f90 modifications, it should be entirely feasible to make changes incrementally while testing.
real(kind=8) may be the most questionable. It's fairly safe to expect it to continue working with the successors of compilers for which it works now. People who use that usually call real*8 fortran 77, even though it isn't. If you search, you will find 1 or 2 currently maintained compilers where one or more of real*8 or real(8) doesn't work, where real(selected_real_kind(12)) does.
I suppose any compiler would correct you on the spelling of deallocate.
All such basic f90 features have been supported by every maintained compiler for at least 5 years. If the application works OK with a current compiler before you make f90 modifications, it should be entirely feasible to make changes incrementally while testing.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks, Tim!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think you have a common misconception - just because a file has a .f file type, that doesn't mean it is "FORTRAN 77 code". Fixed-form source is still standard in Fortran 2008, though it is deprecated. There is no problem using any standard feature in fixed-form source.
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