Phillip Helbig writes:
> A is not needed to compile TEST. Apparently most compilers want it to
> be accessible, though. The question is, does the standard require it to
> be accessible? My guess is that it probably does. There are other
> examples where the standard requires stuff to be accessible even though
> we (or a smart compiler) know it is not needed.
This is *FAR* beyond the level of anything the standard discusses.
Since the main program USEs module B (if I recall the names
correctly), the standard requires that "B be accessible". What that
means is quite unspecified. I've seen at least 3 very different
implementations. One where it means that the source code for B be
available, one where it means that the compiled object code of B be
available, and one where it means that a separate .mod file for B
be available. Plenty of variations in detail even within these 3
schemes. And the compiler is perfectly free to define B being
"available" as also meaning that anything B USEs is also available.
My second para above is just a long-winded version of my first.
The standard aside, the behavior doesn't surprise me at all. I guess
I was a bit more surprised that people wouldn't expect it. Perhaps
I've looked at too many of the human-readable .mod files and gotten
used to the fact that if module B uses module A, then the .mod file
for B is going to have the equivalent of a "USE A" (sometimes even
spelled almost exactly that way), and thus it won't be able to process
the .mod file for B without finding that of A. And I wouldn't really
expect this to depend on what exactly is needed from the module - just
the presence of the USE at all. This all has nothing to do with the
standard, though - just with my expectations.
--
Richard Maine
[log in to unmask]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|