- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
I am porting modules from a unixFortran 77 complierto a windows intel Fortran complier.
I need to know if it is possible to refer to an element in the common block as an array.
For example: Assume my common blockhas the following labels in sequential orderVAR1, VAR2, VAR3, and VAR4. If Ideclare VAR1(4) in my CP of my module,will the complier understand that I am referring to the common block label VAR3 when I use VAR1(3) in the code?
- Etiquetas:
- Intel® Fortran Compiler
Enlace copiado
2 Respuestas
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
No. But you can use EQUIVALENCE to do what you're looking for.
real var1, var2, var3, var4, vars(4)
common /mycommon/ var1, var2, var3, var4
equivalence (var1, vars)
Now you can use vars(3) to get at var3.
real var1, var2, var3, var4, vars(4)
common /mycommon/ var1, var2, var3, var4
equivalence (var1, vars)
Now you can use vars(3) to get at var3.
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
No - if you declare VAR1 as being (4), that will make it push out the other variables and give you incorrect results.
What you want is EQUIVALENCE:
real var1, var2, var3, var4, vars(4)
common /mycommon/ var1, var2, var3, var4
equivalence (var1, vars)
Now you can use vars(3) to get at var3.
What you want is EQUIVALENCE:
real var1, var2, var3, var4, vars(4)
common /mycommon/ var1, var2, var3, var4
equivalence (var1, vars)
Now you can use vars(3) to get at var3.

Responder
Opciones de temas
- Suscribirse a un feed RSS
- Marcar tema como nuevo
- Marcar tema como leído
- Flotar este Tema para el usuario actual
- Favorito
- Suscribir
- Página de impresión sencilla