11-106r1 To: J3 From: Nick Maclaren/Bill Long Subject: Interop TR: array argument terminology Date: 2011 February 14 Reference: N1838 This relates to a pervasive C terminology issue. It does not imply any technical change. C array arguments do not have any number of elements, because they are only arrays during parsing (i.e. the first part of translation phase 4) and are adjusted to pointers before type analysis (in the second part of translation phase 4); the location of that adjustment is not specified in the C standard, with consequences I could describe, but are not critical here. See C99 6.7.5.3 Function declarators, paragraph 7 and elsewhere for more on this mess, though the wording used in the C standard itself is not entirely consistent. While there is a huge amount of inappropriate wording in 10-251, very little of it is actually confusing, and the intent is clear. A few places are not. 5.2.6.4 CFI_address says "If the object is scalar, the result is its address and the subscripts array is ignored." 5.2.6.5 CFI_associate has similar wording. That is seriously ambiguous in C, because it can mean any of the following: 1) The argument must be a valid pointer of the relevant type, but need not point to an object (sic). 2) The argument may be as (1) or may be NULL. 3) The argument need not be a valid pointer value. This is commonly assumed, but is arguably undefined behaviour. The difference can be visible when you run certain checking tools or compilation techniques. I think that a NOTE is sufficient. Edits to N1838: [15:11+] Add following the description of CFI_address: "NOTE 5.3a When an array argument is ignored, its value may be either NULL or a valid pointer value, but it need not point to an object."