Re: Allocatable attribute on derived type components
- From: "gaurav" <gauravgautam123@xxxxxxxxx>
- Date: 30 Jun 2006 09:32:57 -0700
How ever i still cannot understand
1) Since what would happen
Arjen Markus wrote:
Thanks for the help..
gaurav schreef:
Hi,
The F003 standard introduced allocatable attribute on derived type
components. The component with allocatable attribute has to be
allocated seperately using allocatable statment.
However, I could not understand the memory layout of the object of such
derived type object.
For example, consider the following
type drv
integer :: x(10)
real , allocatable :: y(:, :)
end type drv
and then an object obj is defined.
type (drv) :: obj
Can any one help me to understand the memory layout of "obj"? What
would be the size of obj?
Also, what would be the memory layout in case if the derived type is
sequenced?
The feature you describe is available in many Fortran 95 compilers too,
as there is a technical report on it.
But layout should not matter at all - and if it does, it will depend
entirely on the
hardware and the Fortran compiler in question.
My guess is that this is/will be implemented in a very similar way
as for pointer components, that is, "somewhere" a block of memory
will be allocated. It's position is unrelated to the position of "obj".
But then what difference would this create from pointer attribute on
derived type component. since the memory allocation is similar to
pointer one....and also if i just allocate pointer component instead of
aliasing it....this would be like i am using an allocatable
component....why did they provide it altogather..since functionality of
allocatable component can be done with pointer component...also
As to the size, the following code fragment might give a clue:
character(len=1), dimension(1) :: byte
write(*,*) size( transfer(obj,byte) )
Can you explain why you want to know?
Well i was thinking of implementing this in some compiler...
Regards,
Arjen
.
- Follow-Ups:
- Re: Allocatable attribute on derived type components
- From: Richard E Maine
- Re: Allocatable attribute on derived type components
- References:
- Allocatable attribute on derived type components
- From: gaurav
- Re: Allocatable attribute on derived type components
- From: Arjen Markus
- Allocatable attribute on derived type components
- Prev by Date: Re: recl on g95 and gfortran
- Next by Date: Re: EDITOR: Compaq Visual Fortran
- Previous by thread: Re: Allocatable attribute on derived type components
- Next by thread: Re: Allocatable attribute on derived type components
- Index(es):
Relevant Pages
|