From owner-sc22wg5@open-std.org  Thu Jun 11 20:24:20 2009
Return-Path: <owner-sc22wg5@open-std.org>
X-Original-To: sc22wg5-dom7
Delivered-To: sc22wg5-dom7@www2.open-std.org
Received: by www2.open-std.org (Postfix, from userid 521)
	id 09265C76BB7; Thu, 11 Jun 2009 20:24:20 +0200 (CET DST)
X-Original-To: sc22wg5@open-std.org
Delivered-To: sc22wg5@open-std.org
Received: from smtp.llnl.gov (nspiron-3.llnl.gov [128.115.41.83])
	by www2.open-std.org (Postfix) with ESMTP id 3AAB1C4596B
	for <sc22wg5@open-std.org>; Thu, 11 Jun 2009 20:23:55 +0200 (CET DST)
X-Attachments: None
Received: from cyrus2.llnl.gov ([128.15.97.105])
  by smtp.llnl.gov with ESMTP; 11 Jun 2009 11:23:54 -0700
From: Aleksandar Donev <donev1@llnl.gov>
Organization: LLNL
To: sc22wg5@open-std.org
Subject: Re: (j3.2006) (SC22WG5.4005) [ukfortran]  NOT on Paper 09-238
Date: Thu, 11 Jun 2009 11:23:54 -0700
User-Agent: KMail/1.9.4
References: <20090518082831.8FCC8C178E2@www2.open-std.org> <20090611145654.64B8AC4596B@www2.open-std.org> <20090611180733.9804BC4596B@www2.open-std.org>
In-Reply-To: <20090611180733.9804BC4596B@www2.open-std.org>
MIME-Version: 1.0
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
Message-Id: <200906111123.54383.donev1@llnl.gov>
Sender: owner-sc22wg5@open-std.org
Precedence: bulk

On Thursday 11 June 2009 11:07, N.M. Maclaren wrote:

> =A0 =A0 2) With a defined null value (i.e. like NULL())
But that is not a C address, is it? It is a value, for sure.

> =A0 =A0 3) Pointing to the end of an array - such pointer values are
> fully valid, don't point to an object, but can be subscripted with
> (say) -1 to point to an actual, defined data object
> =A0 =A0 4) Pointing to an incomplete array at the end of a structure or
> union - very like (3), but subtly different
Good to know C still does not understand arrays :-)

> (3) and (4) are merely a different way of pointing
> to valid objects. =A0We experts know that Fortran has no equivalent
> feature, so interoperability is implausible.
C_F_POINTER is not about *direct* interoperability. It is about=20
converting a C pointer to a Fortran pointer, so it is perfectly=20
reasonable to allow one to obtain a Fortran pointer to some C object,=20
such as the incomplete array at the end of some structure.

> But WHERE in the standard is that made clear?
No where, but it seems to me if one goes in such details C_F_POINTER has=20
much bigger problems, notably, there are no stated restrictions on=20
SHAPE. For example, if you have a C array of size 10, and a pointer to=20
the middle of it (say element index 5), what is allowed for SHAPE? This=20
would seem more basic than asking what is allowed if the C pointer is=20
the address of the end of an structure with an incomplete array at the=20
end or if it points to the element one past the end of an array.

Best,
Aleks

=2D-=20
Aleksandar Donev, Ph.D.
Lawrence Postdoctoral Fellow @ Lawrence Livermore National Laboratory
High Performance Computational Materials Science and Chemistry
E-mail: donev1@llnl.gov
Phone: (925) 424-6816  Fax: (925) 423-0785
Address: P.O.Box 808, L-367, Livermore, CA 94551-9900
Web: http://cims.nyu.edu/~donev/
