- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
I just came across a curious capability of Fortran in a manual.
Is it true that in Fortran an array can be assigned to itself in reverse order as in:
INTEGER, PARAMETER :: max = ...
REAL ::A(max)
... initialzation of data in A ...
A(1 : max) = A(max : 1 : -1)
without any form of temporary being used?
- Marcas:
- Intel® Fortran Compiler
Link copiado
1 Responder
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
Yes, because the language semantics mean that the compiler creates a temporary for you. Then the compiler tries to figure out if the temporary can be eliminated, which in this case it probably isn't.
In essence, array assignment completely evaluates the right-hand-side of the assignment before assigning to the left-hand-side.
Responder
Opções do tópico
- Subscrever fonte RSS
- Marcar tópico como novo
- Marcar tópico como lido
- Flutuar este Tópico para o utilizador atual
- Marcador
- Subscrever
- Página amigável para impressora