From owner-sc22wg5@open-std.org  Thu Jun 11 21:21:55 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 097CCC76BB7; Thu, 11 Jun 2009 21:21:55 +0200 (CET DST)
X-Original-To: sc22wg5@open-std.org
Delivered-To: sc22wg5@open-std.org
Received: from ppsw-5.csi.cam.ac.uk (ppsw-5.csi.cam.ac.uk [131.111.8.135])
	by www2.open-std.org (Postfix) with ESMTP id 2D459C4596B
	for <sc22wg5@open-std.org>; Thu, 11 Jun 2009 21:21:29 +0200 (CET DST)
X-Cam-AntiVirus: no malware found
X-Cam-SpamDetails: not scanned
X-Cam-ScannerInfo: http://www.cam.ac.uk/cs/email/scanner/
Received: from hermes-2.csi.cam.ac.uk ([131.111.8.54]:47611)
	by ppsw-5.csi.cam.ac.uk (smtp.hermes.cam.ac.uk [131.111.8.155]:25)
	with esmtpa (EXTERNAL:nmm1) id 1MEpq5-0004lL-HG (Exim 4.70) for sc22wg5@open-std.org
	(return-path <nmm1@hermes.cam.ac.uk>); Thu, 11 Jun 2009 20:21:29 +0100
Received: from prayer by hermes-2.csi.cam.ac.uk (hermes.cam.ac.uk)
	with local (PRAYER:nmm1) id 1MEpq5-0004Zw-Am (Exim 4.67) for sc22wg5@open-std.org
	(return-path <nmm1@hermes.cam.ac.uk>); Thu, 11 Jun 2009 20:21:29 +0100
Received: from [83.67.89.123] by webmail.hermes.cam.ac.uk
	with HTTP (Prayer-1.3.1); 11 Jun 2009 20:21:29 +0100
Date: 11 Jun 2009 20:21:29 +0100
From: "N.M. Maclaren" <nmm1@cam.ac.uk>
To: sc22wg5@open-std.org
Subject: Re: [ukfortran] (SC22WG5.4006) (j3.2006)   NOT on Paper 09-238
Message-ID: <Prayer.1.3.1.0906112021290.13957@hermes-2.csi.cam.ac.uk>
In-Reply-To: <20090611182420.3A14AC4596B@www2.open-std.org>
References: <20090518082831.8FCC8C178E2@www2.open-std.org>
 <20090611145654.64B8AC4596B@www2.open-std.org>
 <20090611180733.9804BC4596B@www2.open-std.org>
 <20090611182420.3A14AC4596B@www2.open-std.org>
X-Mailer: Prayer v1.3.1
Mime-Version: 1.0
Content-Type: text/plain; format=flowed; charset=ISO-8859-1
Sender: owner-sc22wg5@open-std.org
Precedence: bulk

On Jun 11 2009, Aleksandar Donev wrote:
>
>>     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.

God alone knows.  Despite 1.3.19 in Fortran, there is no well-defined
meaning of 'address' in C.

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

Yeah.  So you end up getting a valid Fortran pointer to something that
uisn't a valid Fortran target :-(

>> 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 
>much bigger problems, notably, there are no stated restrictions on 
>SHAPE. For example, if you have a C array of size 10, and a pointer to 
>the middle of it (say element index 5), what is allowed for SHAPE? This 
>would seem more basic than asking what is allowed if the C pointer is 
>the address of the end of an structure with an incomplete array at the 
>end or if it points to the element one past the end of an array.

Oh, THAT's not a problem.  Both languages have compatible concepts of
sequence association (though C's is not called that, of course).


Regards,
Nick Maclaren,
University of Cambridge Computing Service,
New Museums Site, Pembroke Street, Cambridge CB2 3QH, England.
Email:  nmm1@cam.ac.uk
Tel.:  +44 1223 334761    Fax:  +44 1223 334679

