Help with interpreting TYPE(*) with INTENT(OUT)
N.M. Maclaren
nmm1@cam.ac.uk
Wed Mar 7 12:05:00 GMT 2012
On Mar 7 2012, Tobias Burnus wrote:
>
> I try to understand how TYPE(*) is supposed to act for non-BIND(C)
> procedures according to TS 29113.
>
> So far, I thought that a scalar TYPE(*) or a non-assumed-shape TYPE(*)
> passes the pointer to the data of the scalar or of the address of the
> first element of the array. That's also what is implied by NOTE 5.1.
No, but that is intended to be permitted. All such statements in this
reply are my understanding, of course, but I was involved in the
relevant discussions.
> However, even though allocatables and pointers are not allowed with
> TYPE(*), INTENT(OUT) seems to be allowed. And as INTENT(OUT) causes
> deallocation of allocatable components and default initialization, there
> is a problem if one has only passed the pointer. (There is no problem
> with finalization as the derived type passed to TYPE(*) may not have
> "type parameters, type-bound procedures, or final procedures" per 6.3p2.)
> However, I wonder whether they are allowed to appear in components of
> that type. But even with out, default initialization alone causes the
> problem.
I think that you have spotted a defect in TS 29113. A better reference
is N1904 from http://www.nag.co.uk/sc22wg5/, and there is a one-month
ballot that ends fairly shortly. I will do my best to comment on this
one.
The intent was definitely not to allow allocatable subcomponents,
either, and NOT to force implementors to trat that case specially.
Indeed, I and others would oppose such a requirement.
If you have time (which I doubt!), I am sure that you would be
appreciated in WG5, even if you never did anything but respond by Email.
Regards,
Nick Maclaren.
More information about the Fortran
mailing list