public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tobias Burnus <burnus@net-b.de>
To: Daniel Franke <franke.daniel@gmail.com>
Cc: fortran@gcc.gnu.org,
	Steve Kargl <sgk@troutmask.apl.washington.edu>,
	 Gerald Pfeifer <gerald@pfeifer.com>,
	gcc-patches@gcc.gnu.org
Subject: Re: [wwwdata] Update Fortran section of gcc-4.6/changes.html
Date: Thu, 16 Dec 2010 10:22:00 -0000	[thread overview]
Message-ID: <4D09C78D.8050306@net-b.de> (raw)
In-Reply-To: <201012152354.06975.franke.daniel@gmail.com>

Gerald Pfeifer wrote:
> +<li>Null pointers (including<code>NULL()</code>) and not
> +       allocated variables can be used as actual argument to optional
> +       non-pointer, non-allocatable dummy arguments, denoting an absent
> +       argument.</li>

> +<li>Non-pointer variables with<code>TARGET</code>  attribute can

Quote from the introduction of the Fortran 2008 standard (cf. 
http://gcc.gnu.org/wiki/GFortranStandards):

"Fortran 2008 contains several extensions to Fortran 2003; some of these 
are listed below." [...]
"Programs and procedures: [...] An actual argument with the TARGET
attribute can correspond to a dummy pointer. A null pointer or 
unallocated allocatable can be used to
denote an absent nonallocatable nonpointer optional argument."

Regarding the latter:
a) Cf. Steve's email about the word "dummy" vs. "actual argument".

b) Fortran allows to have optional arguments. Internally, gfortran (and 
most other Fortran compilers) passes a NULL pointer if the (actual) 
argument is absent. However, doing so as user is only allowed since 
Fortran 2008. (For arrays also a code change was required.)

Daniel Franke wrote:
> since I missed the commit and this is news to me - maybe one could add a word
> why this_is_  news and actually noteworthy?

Regarding the noteworthiness: It is listed in the Fortran 2008 standard 
as being a new feature - thus listing it helps users knowing the F2008 
list  (while others are made aware of this feature); additionally, I 
think it is a quite useful feature as one now can pass, e.g., a 
not-allocated variable as absent argument. Before it only worked for 
scalar variables, relying on a particular implementation - now it also 
works for arrays.

However, one could also move it into the "Minor changes" item at 
http://gcc.gnu.org/gcc-4.6/changes.html#Fortran


> IIRC, there was something that absent dummy arguments where marked by 0L,
> hence one could not pass a NULL pointer as it would be seen as "absent" not as
> "present with value 0". If that's the one, mentioning it might certainly help
> an unaware reader.

No, that's a separate, still unfixed issue which only occurs if one 
mixes (pass by) VALUE with OPTIONAL arguments. (And a Fortran 2003 item 
as VALUE is allowed since 2003.)

(Side note: The upcoming technical report on further C interoperability 
will also allow C_NULL_PTR (C: "NULL") to denote an absent argument and, 
thus, allows "OPTIONAL" in BIND(C) procedure - but not together with VALUE.)

Tobias

      reply	other threads:[~2010-12-16  8:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-19  8:21 Tobias Burnus
2010-08-19  8:41 ` Daniel Kraft
2010-08-19 10:27   ` Tobias Burnus
2010-12-15 22:34 ` Gerald Pfeifer
2010-12-15 23:09   ` Steve Kargl
2010-12-15 23:50     ` Daniel Franke
2010-12-16 10:22       ` Tobias Burnus [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D09C78D.8050306@net-b.de \
    --to=burnus@net-b.de \
    --cc=fortran@gcc.gnu.org \
    --cc=franke.daniel@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=gerald@pfeifer.com \
    --cc=sgk@troutmask.apl.washington.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).