Topic: parameters after ellipses
Author: gcato@sct.edu (Gene Cato)
Date: 21 Aug 1994 00:50:11 -0400 Raw View
An interesting and potentially useful feature of prototype
function signatures could be the ability to have parameters
after ellipses such as
void f(char *p ... char *q);
This would mean that the first parameter must be a char * and
the last parameter must be a char *, but there can be any
number of any type of parameter between. A case where this
would be useful would be for NULL terminated lists of
parameters such as is found in the X Toolkit.
void XtVaSetValues(Widget w ... char *null_terminator);
This would force the final NULL to be interpreted as a char *,
instead of as an integer when you use
XtVaSetValues(w,{various resources and values},NULL);
It would also help avoid accidentally leaving off the
NULL.
The parameters after ellipses would work slightly differently
than normal parameters. Since they would still have to be
interpreted with va_arg they would still have to go
through the untyped parameter conversions so that
void f(... char);
when called as
f(786);
would be interpreted as if f had been declared
void f(...);
and was called like
f((char)786);
What are your opinions?
Until Later,
Vaughn Cato (gcato@st6000.sct.edu)