N3365
Official Function Nomenclature

Published Proposal,

Previous Revisions:
None
Author:
Paper Source:
GitHub
Issue Tracking:
GitHub
Project:
ISO/IEC 9899 Programming Languages — C, ISO/IEC JTC1/SC22/WG14
Proposal Category:
Editorial Fix
Target:
C2y

Abstract

Terminology update for functions.

1. Changelog

1.1. Revision 0 - October 1st, 2024

2. Introduction & Motivation

This paper is a pure editorial change for properly classifying the various parts of function declarations/definitions in C, as there is misleading/confusing terminology surrounding these terms as illustrated by N6559.

3. Possible WG14 Direction?

Two possible names for both sets of things:

Standard currently uses "variable arguments" in places, which strangely I rarely hear in the wild unless directly referencing the title of the clause 7.16.1 <stdarg.h>.

4. Wording

The following wording is registered against the latest working draft as of October 1st, 2024.

4.1. Modify §6.5.5.3 to use variadic

4.2. Modify §6.7.7.4 to define variadic functions

6.7.7.4Functions declarators

If the list terminates with an ellipsis (...), no information about the number or types of the parameters after the comma is supplied. Declarators with the ellipses in a parameter list are known as variadic functions. Arguments supplied to a function whose positions match or come after the ellipsis in the parameter list are its varying arguments.

For two function types to be compatible, both shall specify compatible return types. Moreover, the parameter type lists shall agree in the number of parameters and in use of the final ellipsis whether the function is variadic or not ; …

162)The macros defined in the <stdarg.h> header (7.16) can be used to access arguments that correspond to the ellipsis in variadic functions .

4.3. Modify §6.9.2 to define the types/parts of a function

6.9.2Functions definitions

If a function that accepts a variable number of arguments a declarator for a variadic function is later defined as a non-variadic function, the behavior is undefined.

The parameter type list, the attribute specifier sequence of the declarator that follows the parameter type list, and the compound statement of the function body form a single block.193) The block defined by just the compound statement of a function body, without its parameter type list or attribute specifier sequence, is known as the function body block. Each parameter has automatic storage duration; its identifier, if any,194) is an lvalue.195) The layout of the storage for parameters is unspecified.

4.4. Modify §7.16

4.5. Find-and-replace Changes