- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Does specifying each variable from each module in each routine by the
Use MODULEname, ONLY:
command produce code any different than simply including
Use MODULEname
in all routines that need members of a particular module?
I assume that the compiler/linker essentially does the same function as
USE MODULEname, ONLY:
by removing references to unused variables in a routine?
Just wondering if my time/effort spent on ONLY: is worth it? (aside from readability and of course when there is a duplicate variable and/or need to hide a variable)
Thanks
Brian
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There is no difference between a simple USE and a USE with ONLY that names all entities exported by a module. Remember that also includes any symbols visible through a nested USE. If the module is very large, such as the Win32 API modules, I like to use ONLY to cut down on the number of symbols the compiler has to cope with, and also for documentation purposes, but in general I don't recommend it unless you have a specific need to limit the symbols imported.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ifigured there probably wasn't any difference since it's essentially done by compiler/linker steps. I guess the only real savings is in the COMPILE/LINK step since the compiler and linker are told what varaiables to USE, ONLY: rather than have to sort/figure it out.
Thanks
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The linker is not involved here - it's all compiler. What ONLY does is limit the symbols imported from a module - it doesn't change how the compiler uses those symbols once imported.

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