- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I been looking at the fortwan_winprint.f90 example and it contains USE ONLY statements.
In my programs I have only used USE statements.
Is the only reason for using the ONLY statement is to stop the clash of subroutine names.
Or does using the ONLY statement speed up compilation time, reduce execution time, or make a smaller executable file?
Thanks,
David
In my programs I have only used USE statements.
Is the only reason for using the ONLY statement is to stop the clash of subroutine names.
Or does using the ONLY statement speed up compilation time, reduce execution time, or make a smaller executable file?
Thanks,
David
Link Copied
9 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As far as I can remember from the documentation, USE ONLY certainly speeds up compilation. But I use it every time because I find it a very useful way of documenting which routines & constants have been imported from what modules into my source code.
Regards
Alan
Regards
Alan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ONLY does speed compilation, especially with very large modules, and I also like the documentation issue.
Steve
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have been going through my code changing USE to USE ONLY.
I find in some places I have to replace USE dfwin with USE dfwin, ONLY : WM_HELP,WM_INITDIALOG, etc.
In other places where WM_HELP & WM_INITDIALOG are used I can remove USE dfwin completely and it compiles OK - I am not using any other USE statements.
Any ideas why this occurs ?
Thanks,
David
I find in some places I have to replace USE dfwin with USE dfwin, ONLY : WM_HELP,WM_INITDIALOG, etc.
In other places where WM_HELP & WM_INITDIALOG are used I can remove USE dfwin completely and it compiles OK - I am not using any other USE statements.
Any ideas why this occurs ?
Thanks,
David
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Got IMPLICIT NONE?
The WM_ symbols are defined in DFWINTY, which is implicitly used by all of the various DFWIN modules. If you aren't using IMPLICIT NONE, then the symbols are undeclared variables and get default typing - probably not what you want.
Steve
The WM_ symbols are defined in DFWINTY, which is implicitly used by all of the various DFWIN modules. If you aren't using IMPLICIT NONE, then the symbols are undeclared variables and get default typing - probably not what you want.
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I haven't used IMPLICIT NONE - but in Project Settings - Compilation Diagnostics, I have ticked undeclared symbols.
I'm still confused.
Dsvid
I'm still confused.
Dsvid
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How about posting a short example that doesn't use USE statements? I'm interested in seeing it. Do you USE any other modules that USE DFWIN and friends?
Steve
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It's my mistake.
I was sometimes using a "USE MyModule" which I hadn't realised included a USE dfwin.
Thanks,
David
I was sometimes using a "USE MyModule" which I hadn't realised included a USE dfwin.
Thanks,
David
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ok - thought it might be something like that.
I strongly suggest that in your modules you use ONLY clauses, and/or use PRIVATE and then make PUBLIC only the symbols you want to export. ONLY is better than PRIVATE for restricting module namespaces, from the compiler's viewpoint, however. (Both is fine!)
Steve
I strongly suggest that in your modules you use ONLY clauses, and/or use PRIVATE and then make PUBLIC only the symbols you want to export. ONLY is better than PRIVATE for restricting module namespaces, from the compiler's viewpoint, however. (Both is fine!)
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I replaced my "Use dfwin" with "use dfwin, only:" and found compilation time INCREASED from 10 to 24 minutes.
So I have just gone back to how it was before.
David
So I have just gone back to how it was before.
David

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