(j3.2006) [Interop-tr] definition of CFI_CDESC_T

N.M. Maclaren nmm1
Tue Apr 24 05:16:15 EDT 2012


On Apr 24 2012, Malcolm Cohen wrote:
>
>(cc'd to interop-tr which is probably a better place for discussion).

Now set as the Reply-to.

> That does not look like "a type suitable for declaring a C descriptor" to 
> me.
>
>Surely, given
>   CFI_CDESC_T(2) x; then x must be a C descriptor, and therefore &x must 
> be compatible with CFI_cdesc_t*, and x.base_addr et al should be usable; 
> neither of those things appear to be true of this (that or my eyes have 
> glazed over too much).
>
> It might be "a type suitable for declaring something [that might be] at 
> least as big as a type suitable for declaring a C descriptor", but that 
> is a horse of a decidedly different colour, no?

Yes, but it is actually the horse that the TS is riding :-(  A long,
long time ago, I suggested a macro that took the variable and declared
it as CFI_cdesc_t *, pointing to a suitable area of memory.  However,
that wasn't nice in other ways, and the decision was taken to merely
allocate the memory - hence the example with a cast.

The wording is wrong in C terms, but this is just another example of the
dilemma of whether to use Fortran or C terminology.  But the sentence
"A pointer to a variable declared using CFI_CDESC_T can be cast to
CFI_cdesc_t *." makes it pretty clear how it is intended to be used.
The example code delivers everything that is needed.

It could be rephrased as something like:

    "... and evaluates to a type of suitable size and alignment for
    defining a variable to use as a C descriptor of that rank."


Regards,
Nick.







More information about the J3 mailing list