- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is there any solution for me to change all implicit data type into explicit data type in my F77 code?
The implicit type hamper me badly form modifying the source code.
Thanks
The implicit type hamper me badly form modifying the source code.
Thanks
Link Copied
10 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The plusFORT utility from Polyhedron should be able to do it for you.
Alternatively, add "IMPLICIT NONE" before any declarations and the compiler will tell you which variables need to be declared. Then manually add each declaration.
All the best,
Eddie
Alternatively, add "IMPLICIT NONE" before any declarations and the compiler will tell you which variables need to be declared. Then manually add each declaration.
All the best,
Eddie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
adding "implicit none" is what I want to do, but the compiler wont tell which type the implicit type variable should be set.
I will try Polyhedron.
Thanks
I will try Polyhedron.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What a pity.
There is plusFORT for linux avaiable.
There is plusFORT for linux avaiable.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Unless I have misunderstood the question, maybe the Fortran implict typing rules will help: INTEGER for variable names starting I to N, and REAL for all other letters.
Eddie
Eddie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How is the compiler supposed to know which type you want?
As mentioned above, IMPLICIT NONE will remove all implicit typing rules and will tell you which variables do not have types explicitly specified. The compiler does not have the "mind reader" option to know what type you meant! :-)
Steve
As mentioned above, IMPLICIT NONE will remove all implicit typing rules and will tell you which variables do not have types explicitly specified. The compiler does not have the "mind reader" option to know what type you meant! :-)
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I wanna explicitly declare all the variable which already exist in my F77 code.
steve, is there any solution for me?
Is it possible for me to check the type in runtime ?
Is there any utility in win9x for me?
steve, is there any solution for me?
Is it possible for me to check the type in runtime ?
Is there any utility in win9x for me?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As Eddie pointed out, there are commercial tools that can do it for you. Another one is Fortran Partner(there's also a free "lite" version, check if it has that capability).
You can do it yourself as well, with a bit more effort. First, in Project/Settings/Fortran/Listing files, check "Source listing". Build your project. That will generate a set of .lst files in your /Debug folder, containing, among other things, lines containing all variables used in routines:
Jugoslav
You can do it yourself as well, with a bit more effort. First, in Project/Settings/Fortran/Listing files, check "Source listing". Build your project. That will generate a set of .lst files in your /Debug folder, containing, among other things, lines containing all variables used in routines:
VARIABLES Address Type Name Address Type Name 1-00000008 I*4 I 1-00000004 I*4 M ARRAYS Address Type Name Bytes Dimensions 3-00000000 CHAR OS 24 (6) 1-0000000C R*4 X 20 (5)You could use a smart find/replace (or write a macro in VS) to convert these to normal declarations, which you should paste into your code. Add "implicit none" to your routines (and/or check Project/Settings/Fotran/Compilation diagnostics/Undeclared symbols warning). Good luck.
Jugoslav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Perhaps I'm missing something here...
Jugoslav, how does having a list of all the variables in a routine help in deciding which ones need declaring?
IMPLICIT NONE (or the compiler option /warn:declarations as Jugoslav mentions) will cause the compiler to warn you about each variable used in the program that is not explicitly declared, and the message will name the variable. You compile, look at the variables it complains about, add the appropriate declarations, repeat until no more messages.
What it won't do is automatically generate the declaration for you according to the implicit type. I guess that's what the Fortran Partner (and perhaps others) tool will do and maybe that's what's being looked for?
The problem I have with this is that in many cases I see, the implicit datatype is NOT the correct one! Many programs go for years without this error being noticed - sometimes it's "mostly harmless", other times bad results are being quietly generated. I would not trust an automated tool to make the right choices here.
Steve
Jugoslav, how does having a list of all the variables in a routine help in deciding which ones need declaring?
IMPLICIT NONE (or the compiler option /warn:declarations as Jugoslav mentions) will cause the compiler to warn you about each variable used in the program that is not explicitly declared, and the message will name the variable. You compile, look at the variables it complains about, add the appropriate declarations, repeat until no more messages.
What it won't do is automatically generate the declaration for you according to the implicit type. I guess that's what the Fortran Partner (and perhaps others) tool will do and maybe that's what's being looked for?
The problem I have with this is that in many cases I see, the implicit datatype is NOT the correct one! Many programs go for years without this error being noticed - sometimes it's "mostly harmless", other times bad results are being quietly generated. I would not trust an automated tool to make the right choices here.
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jugoslav, how does having a list of all the variables in a routine help in deciding which ones need declaring?
Well, every one needs declaring, doesn't it? If one wants to "implicitnonize" the program he needs the list of variables to start with. Exceptions would be common blocks brought in scope via INCLUDE (in which case you'd get redeclaration errors anyway) and module variables (which aren't an issue for OP) anyway.
What it won't do is automatically generate the declaration for you according to the implicit type. I guess that's what the Fortran Partner (and perhaps others) tool will do and maybe that's what's being looked for?
Yep, that was my reading of the question.
The problem I have with this is that in many cases I see, the implicit datatype is NOT the correct one!
Well, there's no magic wand for such situations anyway.
Jugoslav
Well, every one needs declaring, doesn't it? If one wants to "implicitnonize" the program he needs the list of variables to start with. Exceptions would be common blocks brought in scope via INCLUDE (in which case you'd get redeclaration errors anyway) and module variables (which aren't an issue for OP) anyway.
What it won't do is automatically generate the declaration for you according to the implicit type. I guess that's what the Fortran Partner (and perhaps others) tool will do and maybe that's what's being looked for?
Yep, that was my reading of the question.
The problem I have with this is that in many cases I see, the implicit datatype is NOT the correct one!
Well, there's no magic wand for such situations anyway.
Jugoslav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks all of u! :)

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