This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of NAD status.

### 269. cstdarg and unnamed parameters

Section: 17.10 [support.exception] Status: NAD Submitter: J. Stephen Adamczyk Opened: 2000-10-10 Last modified: 2016-01-28

Priority: Not Prioritized

View all other issues in [support.exception].

View all issues with NAD status.

Discussion:

One of our customers asks whether this is valid C++:

       #include <cstdarg>

       void bar(const char *, va_list);

       void
       foo(const char *file, const char *, ...)
       {
         va_list ap;
         va_start(ap, file);
         bar(file, ap);
         va_end(ap);
       }

The issue being whether it is valid to use cstdarg when the final parameter before the "..." is unnamed. cstdarg is, as far as I can tell, inherited verbatim from the C standard. and the definition there (7.8.1.1 in the ISO C89 standard) refers to "the identifier of the rightmost parameter". What happens when there is no such identifier?

My personal opinion is that this should be allowed, but some tweak might be required in the C++ standard.

Rationale:

Not a defect, the C and C++ standards are clear. It is impossible to use varargs if the parameter immediately before "..." has no name, because that is the parameter that must be passed to va_start. The example given above is broken, because va_start is being passed the wrong parameter.

There is no support for extending varargs to provide additional functionality beyond what's currently there. For reasons of C/C++ compatibility, it is especially important not to make gratuitous changes in this part of the C++ standard. The C committee has already been requested not to touch this part of the C standard unless necessary.