Re: Allocatable Arrays As Outputs



<bonzaboy@xxxxxxxxx> wrote:

You can try using pointers instead (they are pretty simple to use in
f95).

However, they would do nothing to solve either of the problems with the
OP's code, as pointers have exactly the same requirements. Namely

1. The array in the main program also needs the comparable property
(pointer or allocatable as the case may be).

2. The subroutine needs an explicit interface.

The only thing solved by using pointer is to make the code
f90/f95-conforming, as allocatable dummy arguments require either f2003
or f95+TR. But most compilers do support the TR by now, and that does
not appear to be the OP's problem.

I would say that changing to using a pointer here would not solve any
problems, but might add new ones (memory management problems and the
likelihood of errors both go way up with pointers compared to
allocatables).

If you declare propertynames as a pointer...

You also have to use the
save attribute in the subroutine to ensure the memory isn't lost when
the subroutine exits.

That is not so.

In fact, you are not allowed to use SAVE for dummy arguments at all.

--
Richard Maine | Good judgement comes from experience;
email: last name at domain . net | experience comes from bad judgement.
domain: summertriangle | -- Mark Twain
.



Relevant Pages

  • Re: Is Fortran faster than C?
    ... So I think F2003 has the benefits of a language with garbage ... So you can use allocatables to set up ... compiler from implementing GC for pointer variables, ... subroutine add_node ...
    (comp.lang.fortran)
  • Re: Pointer-valued function to access inner components
    ... implicit none ... Return a F90 pointer which points to the diagonal of T. ... a copyin/copyout on array A during the procedure call. ... subroutine dirty_pointer_1d ...
    (comp.lang.fortran)
  • Re: Fortran based MEX w/ COMMON/SAVE
    ... I believe dat (pointer to the array) and the ... SAVE at the begining of each subroutine is a bit unusual to me. ... > to unload it if there isn't a Fortran END or STOP statement. ... interaction w/ Matlab). ...
    (comp.soft-sys.matlab)
  • Re: Copy-in/Copy-out
    ... -|declared as a target or pointer, it should be safe to assign a pointer ... -| Character, Intent:: str* ... -| End Interface ... -| Subroutine SubTarget! ...
    (comp.lang.fortran)
  • background process to monitor cursor location
    ... Inside the Document_Opensubroutine, I am using the Timer and DoEvents ... text form fields used for data entry, then a pointer to that field is stored. ... My concern/question: ...
    (microsoft.public.word.vba.general)