Common block usage in Fortran -


I'm new to Fortran and I'm just doing a few simple things to do. And, in general, as a new programmer, it is not certain how it works, so please forgive me if my explanation or notation is the best, there are general announcements at the top of the file. I was told by telling the person that It seems like a structure in C, and that they are global, even in the same. File, how have they declared it? So this is something like this:

  Common AOMVAR Integer * 2 AoEVR  

And then when I actually used it in another file, then They declare local variables (for example SOMEVAR_LOCAL) and depending on the condition, they set SOMEVAR_LOCAL = 1 or 0.

Then there is another conditional line which will say something like this later

  if (SOMEVAR_LOCAL. Eq. 1) SOVVAR (PARAM) = 1;  

(Again I apologize if this is not a proper fortran, but I do not have the code yet). So I feel like the "activate" variable that is called SOMEVAR which is some length (2 bytes of data), then there is a local variable that is used as a flag, so that later Line, global straight SOMEVAR can be set to that value. But because there (PARAM), is it like an array for that particular example? Thank you. Sorry for my poor explanation, but hopefully you will understand whatever you are asking.

The first declaration SOMEVAR is a scalar integer of two bytes, Array is - depending on it being indexed. It is possible to do this in Fortran through "Sequence Association" but it is poor practice. In one file you can declare SOMEVAR as INTEGER * 2 and two bytes can be allocated to this scalar. In another file you can declare it as Integir * 1 AOVVR (2), and two bytes are reserved, at this time for an array of two elements, by using the same common block in each byte of both the files To overlap these two variables, the byte-sequence may be a cause of byte association. Many years ago, when the memory was very small, the programmer did it to reduce memory usage, knowing that various subpractions were using variables at different times. Due to doing so today, it is very limited that most people should not do this because it is important to be misleading.

You can also setup the Sequence Association with the EQUIVALENCE statement. Again, best to save. Modern replacement for a time that requires "difficult" things that require an Equal Statement Transfer Function.


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -