61224

How does one use multiple modules in fortran without name clashes

Question:

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 a and 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.

Recommend

  • integrating a function
  • Arduino - struct out of scope why?
  • Transforming multiindex to row-wise multi-dimensional NumPy array.
  • How can I ensure Realm schema is identical across Android and iOS?
  • Jhipster: How to create relationships with User entity using supplied tools?
  • JPA/EclipseLink Returning No Results
  • Receive custom intent without activity restart
  • NHibernate proxyexception
  • Can't compile Arduino CapSense example
  • Is there a way to call library thread-local init/cleanup on thread creation/destruction?
  • Accessing the variables from a PHP Anonymous Function
  • Insertion large number of Entities into SQL Server 2012 [duplicate]
  • ASPNetCore MVC Routing Let Server Handle Specific Route
  • can variables be set randomly when declaring them again?
  • I am receiving HibernateException “No Hibernate Session bound to thread, and configuration does not
  • Two Tables Serving as one Model in Rails
  • How can Delete be both a DDL and a DML statement
  • Simple linked list-C
  • How do I signal completion of my dataflow?
  • c# open webrowser in many tab
  • pyodbc doesn't report sql server error
  • Instantiate interface in JAVA?
  • Force show.bind execution
  • how to avoid repetitive constructor in children
  • How to get Eclipse Oxygen to run on Java 9
  • Swift: Switch statement fallthrough behavior
  • How to delay loading a property with linq to sql external mapping?
  • Control modification in presentation layer
  • Disabling Alt-F4 on a Win Forms NotifyIcon
  • Can I display google adwords (AdView) in javafx on android
  • Uncaught Error: Could not find module `ember-load-initializers`
  • Opengl-es onTouchEvents problem or a draw problem? [closed]
  • output of program is not same as passed argument
  • Javascript + PHP Encryption with pidCrypt
  • Large data - storage and query
  • log4net write single file for each call to log.info
  • Getting Messege Twice Using IMvxMessenger
  • How can i traverse a binary tree from right to left in java?
  • How can I use threading to 'tick' a timer to be accessed by other threads?
  • jQuery Masonry / Isotope and fluid images: Momentary overlap on window resize