Question about structures,intent(in),pointer elements
Mikael Morin
mikael.morin@sfr.fr
Sat Feb 1 22:05:00 GMT 2014
Le 01/02/2014 15:55, Rimvydas Jasinskas a écrit :
> Just to be clear I understand that this *is* defined by f2003 and
> f2008 standard:
> NOTE 5.13
> If a dummy argument is a derived-type object with a pointer
> component, then the pointer as a
> pointer is a subobject of the dummy argument, but the target of
> the pointer is not. Therefore, the
> restrictions on subobjects of the dummy object apply to the
> pointer in contexts where it is used as
> a pointer, but not in contexts where it is dereferenced to
> indicate its target. For example, if X is a
> dummy argument of derived type with an integer pointer component
> P, and X has INTENT(IN),
> then the statement
> X%P => NEW_TARGET
> is prohibited, but
> X%P = 0
> is allowed (provided that X%P is associated with a definable target).
>
> What worries me, that only easy way to detect this behaviour with gfortran
> is by changing pointer->allocatable, that is very hard for deeply
> nested structures.
> Or alternatively use ifort, since it currently rejects code like this...
>
So you don't want to be able to change the value of your argument but
you want to be able to deallocate/retarget it?
I don't think it's possible; at least it would go against the principle
of INTENT(IN) which tells: this value doesn't change.
Mikael
More information about the Fortran
mailing list