- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
When A is an allocatable array, provided that the option /assume:realloc_lhs is used, the following syntax is correct:
A= [1,2,3]
But how do I allocate A to size 0 (short of a proper ALLOCATE statement)? A = [] does not work (with IVF 11.1). It's a bit of an academic questoin, but for debugging purposes it's quite helpful.
Thanks,
Olivier
A= [1,2,3]
But how do I allocate A to size 0 (short of a proper ALLOCATE statement)? A = [] does not work (with IVF 11.1). It's a bit of an academic questoin, but for debugging purposes it's quite helpful.
Thanks,
Olivier
- Balises:
- Intel® Fortran Compiler
Lien copié
5 Réponses
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
You might try:
A = [ (i, i=1,0) ]
I do not know why your original statement does not work, but the above creates a zero-length
array explicitly, so I expect it to do the trick.
Regards,
Arjen
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
Put a type-spec in the array-constructor.
A = [ INTEGER :: ]
A = [ INTEGER :: ]
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
Thanks Ian - it works! It does look a bit weird, certainly.
Olivier
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
>>it works! It does look a bit weird
What is the data type on the rhs with
A = []
?
Fortran does not have a "void" type, but it does have an empty array of (specified) type.
What is the data type on the rhs with
A = []
?
Fortran does not have a "void" type, but it does have an empty array of (specified) type.
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
Jim,
It's an INTEGER allocatable array. I was looking for the convenience of A = []. Ian suggestion works.
Olivier
It's an INTEGER allocatable array. I was looking for the convenience of A = []. Ian suggestion works.
Olivier
Répondre
Options du sujet
- S'abonner au fil RSS
- Marquer le sujet comme nouveau
- Marquer le sujet comme lu
- Placer ce Sujet en tête de liste pour l'utilisateur actuel
- Marquer
- S'abonner
- Page imprimable