Allocatable components of derived types 
Author Message
 Allocatable components of derived types

Hi everybody.

I have a problem with allocatable components of derived types using
Compaq Visual fortran 6.5.

Into a module, I've written:

    TYPE porous_material
        REAL(KIND(1.d0))    , ALLOCATABLE :: tw(:)
        REAL(KIND(1.d0))    , ALLOCATABLE :: porosity(:)
        REAL(KIND(1.d0))    , ALLOCATABLE :: filtreff(:)
        REAL(KIND(1.d0))    , ALLOCATABLE :: k_wall(:)
        REAL(KIND(1.d0))    , ALLOCATABLE :: d_collector(:)
        REAL(KIND(1.d0))    , ALLOCATABLE :: d_pore(:)
    END TYPE porous_material

During the compilation on my computer I've got the error:

    Error: This attribute specification is not valid for a component
definition statement. [ALLOCATABLE]
    DOUBLE PRECISION    , ALLOCATABLE :: tw(:)
    Error: This ALLOCATABLE attribute is invalid; the ALLOCATABLE
attribute can only be used when declaring array objects.   [TW]
    DOUBLE PRECISION    , ALLOCATABLE :: tw(:)

for every component of the derived type.

The strange thing is that on another computer with the same CVF, the
same module is compiled without problems.
I think it's surely a setting problem, but until now I couldn't solve
it.

Does someone know what it's happening?

Thanks in advance for your answers and suggestions.

Marco Polloni



Tue, 22 Jul 2008 20:59:25 GMT  
 Allocatable components of derived types
| Hi everybody.
|
| I have a problem with allocatable components of derived types using
| Compaq Visual Fortran 6.5.
|     Error: This attribute specification is not valid for a component
| definition statement. [ALLOCATABLE]
|     DOUBLE PRECISION    , ALLOCATABLE :: tw(:)
|     Error: This ALLOCATABLE attribute is invalid; the ALLOCATABLE
| attribute can only be used when declaring array objects.   [TW]
|     DOUBLE PRECISION    , ALLOCATABLE :: tw(:)
|
| for every component of the derived type.
|
| The strange thing is that on another computer with the same CVF, the
| same module is compiled without problems.
| I think it's surely a setting problem, but until now I couldn't solve
| it.

I seriously doubt it's "the same CVF".

Go to:

http://h21007.www2.hp.com/dspp/tech/tech_TechDocumentDetailPage_IDX/1...

download and install the upgrades.

--
 Jugoslav
___________
www.xeffort.com

Please reply to the newsgroup.
You can find my real e-mail on my home page above.



Tue, 22 Jul 2008 21:03:12 GMT  
 Allocatable components of derived types
Hi Jugoslav.
Thanks for your suggestion.
I've downloaded the 6.5A update for CVF, but it still doesn't work.
My friend's computer where the code runs has no updates and both his
computer and mine have Visual C too.
Is not possible that the problem is in the settings?
Have you got any other ideas?
Thanks.
Marco


Tue, 22 Jul 2008 21:40:20 GMT  
 Allocatable components of derived types
Hi Jugoslav.
I'm really really sorry.
My colleague told me he was sure his version of CVF was 6.5. Indeed
when we made a control, I found it was 6.6.
I've just made the upgrade and I have no more problems.
I'm so sorry to have made you wasting time.
Best regards.
Marco Polloni


Tue, 22 Jul 2008 22:10:36 GMT  
 Allocatable components of derived types

Quote:

> Hi Jugoslav.
> I'm really really sorry.
> My colleague told me he was sure his version of CVF was 6.5. Indeed
> when we made a control, I found it was 6.6.
> I've just made the upgrade and I have no more problems.
> I'm so sorry to have made you wasting time.
> Best regards.
> Marco Polloni

Marco, to fill you in a bit more on why your code didn't compile previously:
ALLOCATABLE derived-type components are not part of standard Fortran 95, but
they are introduced in an official extension to the standard known as TR 15581.

Nowadays, almost all compilers suppor this extension (and it is part of the
Fortran 2003 standard, with some very minor modifications), but if you use a
slightly older version of a compiler, you may run into problems with buggy or in
your case missing TR support.

cheers,

Rich



Wed, 23 Jul 2008 01:25:13 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Allocatable components of Derived Types

2. Allocatable components of derived types

3. save'ing allocatable components of derived types

4. Allocatable Components of Derived Type

5. Allocatable derived type with allocatable components in fortran 90

6. Allocatable derived type components (more TR15581 troubles)

7. Allocatable derived type components fail

8. Allocatable attribute on derived type components

9. Standard query: Bounds of allocatable components from derived-type constructors?

10. allowed derived type component types

11. Derived types containing components of PRIVATE type

12. how to use derived types with allocatable elements for I/O

 

 
Powered by phpBB® Forum Software