Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Function questions?
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Wolfgang Kilian  
View profile  
 More options Aug 28 2012, 5:44 am
Newsgroups: comp.lang.fortran
From: Wolfgang Kilian <see...@domain.invalid>
Date: Tue, 28 Aug 2012 11:44:47 +0200
Local: Tues, Aug 28 2012 5:44 am
Subject: Re: Function questions?
On 08/28/2012 11:02 AM, glen herrmannsfeldt wrote:

> Wolfgang Kilian<see...@domain.invalid>  wrote:

> (snip)
>> I did experience quite a few of difficult-to-find bugs by using pointers
>> since Fortran 90, in particular nonlocal pointers.  Both in (my) code
>> and in compilers.  It just happens that I don't remember a problem
>> related to pointer-returning functions.  In fact, the most common coding
>> mistake was not too keep proper track of TARGET attributes.  Maybe, I
>> use such functions only in a very restrictive way.  Probably I'm neither
>> novice nor expert.

> There are a few things that are much easier with pointers,
> such as linked lists and trees. For those cases, I don't see much
> wrong with functions returning pointers.

And IIRC, Fortran 2008 introduces recursive derived types with
ALLOCATABLE components, so pointers will no longer be required for
allocating ordinary lists/trees - hopefully.

> It is not good for a function to return the only pointers to
> something, such that the caller is responsible for deallocating it.
> Returning an element of a linked list or a node of a tree,
> as a pointer, shouldn't be so bad, though. There should be a
> list or tree deallocator, though.

Final subroutines - which unfortunately are among the last parts of
F2003 to be implemented in compilers.

>> Fortunately, with each iteration of the Fortran standard, the number of
>> situations where pointers are really necessary decreases rapidly.

> -- glen

-- Wolfgang

--
E-mail: firstnameinitial.lastn...@domain.de
Domain: yahoo


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.