- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Link Copied
5 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Put a type-spec in the array-constructor.
A = [ INTEGER :: ]
A = [ INTEGER :: ]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Ian - it works! It does look a bit weird, certainly.
Olivier
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
>>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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page