best way to use the USE statement



Let's say I have 3 modules - moda, modb, modc

Say modc has 3 subroutines modc_suba, modc_subb, modc_subc

modc_suba needs moda
modc_subb needs modb
modc_subc needs both moda, modb

Is it better to do

**************** Design 1 *****************
module modc
use moda
use modb
contains
subroutine modc_suba
...
end subroutine modc_suba

subroutine modc_subb
...
end subroutine modc_subb


subroutine modc_subc
...
end subroutine modc_subc
end module modc

or is it better to do

**************** Design 2 *****************
module modc
contains
subroutine modc_suba
use moda
end subroutine modc_suba

subroutine modc_subb
use modb
end subroutine modc_subb

subroutine modc_subc
use moda
use modb
end subroutine modc_subc
end module modc

I used to think that the 2nd approach is better since it clearly highlights what modules each subroutine needs etc., However, when I am extending this philosophy to large programs (typically dealing with 20 modules each having around 20 subroutines), the code is taking hell of a time to compile with Absoft pro 8.0 on a Debian Etch machine. The time spent in linking is very very small compared to time spent in compiling.

I think think this is because in "Design 2" in each subroutine, the compiler is trying to put the code of the modules referred where as in the "Design 1" the compiler puts the code of modules just once. Am I correct so far?

Aside from my reasoning, what are the advantages and disadvantages of one design over the other? Which one should be preferred for large scale programs?

thanks
raju

--
http://kamaraju.googlepages.com/cornell-bazaar
http://groups.google.com/group/cornell-bazaar/about
.