To: X3J3

From: C/Interop

Subject: stdargs

Background

 

ANSI C provides a method for "variable argument lists". This is a very commonly used feature of C (e.g. printf(fmtstring,arg1..argN)). Key features are that neither the total number of arguments nor the types are known at declaration time. Subgroup having received direction from the committee proposes specs, syntax and approximate edits.

Specification

 

BIND(C) interface block definitions may include dummy arguments which are normal dummy arguments, "varying" data objects defined by ellipsis () (three decimal points, providing an arbitrary number and arbitrary types of entities each with an implicit varying attribute). Actual arguments corresponding to elided dummy arguments that are eligible for the VALUE attribute are "given it" implicitly.

 

Example:

Bind(c, name='csub') subroutine c_sub(I,)

Integer (C_INT):: I

 

This provides for one mandatory (C) integer, and an arbitrary number of additional arguments of any type.

Legitimate invocations of c_sub would be:

 

Call c_sub(I) ; call c_sub(I,J) ; call c_sub(I,J,X) ; call c_sub(I,J,x,y,z); etc.

 

However, call c_sub(1.0) would be non-standard conforming.