(j3.2006) CFI_index_t

Bill Long longb
Fri Feb 10 11:07:58 EST 2012

On 2/10/12 2:14 AM, Robert Corbett wrote:
> The definition given for CFI_index_t in Clause 8.3.2 of the draft
> Further C Interoperability TS is not clear. The definition is
> CFI_index_t is a typedef name for a standard signed integer type
> capable of representing the result of subtracting two pointers.

Which was carefully crafted by our C expert.

For me, it has the right operational content.  Things declared 
CFI_index_t  are typically values you want to add to, or subtract from, 
an existing pointer to get a new pointer that points to the object you 
are attempting to access.  Seems to me the definition says exactly the 
right thing.

> I assume the definition does not mean the result of subtracting two
> arbitrary pointers. I assume that the definition assumes something like
> the definition of pointer subtraction provided in the C standard, but
> extended to handle cases not defined by the C standard. One important
> issue is whether the definition is based on pointers to elements of C
> arrays or pointers to elements of Fortran arrays. For some Fortran

Objects declared with CFI_index_t are always in the C domain.  These are 
C pointers we're taking about.

> processors and C companion processors, that difference will make a
> difference in the required size of the integer type. Here is my best

A C processor that has a different addressing range from a Fortran 
processor is a pretty poor choice as a "companion" processor.     This 
would break even the F2003 form of interoperability.


> guess at the intended meaning of the definition:
> CFI_index_t is a typedef name for a standard signed integer type
> capable of representing the integers from -N to N, where N is the
> largest number of elements the Fortran processor supports for an
> array whose elements are not zero-sized.
> I can easily imagine that I have not correctly guessed the intended
> meaning. If that is the case, please let me know how my proposed
> definition differs from the intended meaning.
> Robert Corbett
> _______________________________________________
> J3 mailing list
> J3 at j3-fortran.org
> http://j3-fortran.org/mailman/listinfo/j3

Bill Long                                           longb at cray.com
Fortran Technical Support    &                 voice: 651-605-9024
Bioinformatics Software Development            fax:   651-605-9142
Cray Inc./Cray Plaza, Suite 210/380 Jackson St./St. Paul, MN 55101

More information about the J3 mailing list