Suppose in my main program I want to use two modules, module a and module b. These two modules independently use a third module, module c. Am I correct in thinking that name clashes will result? i.e the declared entities in module c will effectively be redeclared in both modules a and b as a result of the USE statements. If so, how does one get around this? Is it possible to have a PRIVATE statement somewhere to avoid the trouble?
Thanks for taking the time to read the question.Answer1:
Name clashes won't result.
Yes, public entities in
c will be use-associated in
b, and then in your main program, but no ambiguity will be introduced.
module c integer int end module c module a use c end module a module b use c end module b program main use a use b ! use c int = 1 end program
Your confusion may be "declared entities in module c will effectively be redeclared": there is association, but the same declaration is used. This is in contrast with, say, C header files.