(j3.2006) Suggestion for Fortran 201x: Adding support for ignoring the TKR of the actual argument

Tobias Burnus burnus
Fri Mar 1 18:46:47 EST 2013


Bill Long wrote:
> On 2/28/13 4:49 PM, Tobias Burnus wrote:
>> Several compilers support some option to allow for the Fortran
>> equivalent to C's "void *buffer" using a directive such as:
>>
>>      !DEC$ ATTRIBUTES NO_ARG_CHECK :: buf
>>      !$PRAGMA IGNORE_TKR buf
>>      !DIR$ IGNORE_TKR buf
>>      !IBM* IGNORE_TKR buf
>>
>> There is unfortunately no way to do this in standard Fortran. The
>> closest are:
>>
>> * TYPE(*), DIMENSION(*) - which doesn't allow for scalars but only
>> arrays and array elements
> TYPE(*) works for scalars (no dimension...).  If you have only one of
> the buffer arguments (which is typical) the you can make the routine
> generic, with one argument scalar and the other an array.

First, having two "void *buffer" arguments might also occur.

Secondly, and that's a much bigger issue: If I use a generic interface, 
"dimension(*)" will cease to accept arrays of any rank. Thus, I have to 
add a scalar version and one array version per rank.

"If the procedure is nonelemental and is referenced by a generic name or 
as a defined operator or defined assignment, the ranks of the actual 
arguments and corresponding dummy arguments shall agree." (Cf. Fortran 
2008, 12.5.2.4 Ordinary dummy variables, paragraph 13)

> And give both  specifics the same binding name (of the C function that will accept either).  It is sort of involved, but does not involve any modifications to the standard.

Well, I didn't claim that it isn't possible, but creating 16 generic 
procedures ? or with two such dummy arguments 32 ? is not really convenient.

Tobias



More information about the J3 mailing list