Varargs in new C standard
trt at rti-sel.UUCP
trt at rti-sel.UUCP
Sat Aug 11 04:37:51 AEST 1984
None of the proposals I have seen would fix the 'execl' problem:
execl("/bin/date", "date", 0); /* should be (char *)0 */
FIX 1 (a varying number of arguments of specified type):
int execl(char * ...); /* no comma! (yup, obscure) */
to mean 0 or more arguments of type char *, whereas
int printf(char *, ...);
means a char * followed by 0 or more arguments of unknown type.
The correct specification for execl would really be:
int execl(char *, char * ...); /* execl has >= 1 argument */
I suppose one might have a strange function like:
int weird(int ..., float, ..., char *);
which means ... oh forget it. Pity the compiler writers.
FIX 2 (overloaded(?) declarations):
int execl(char *); int execl(char *, char *);
int execl(char *, char *, char *); ...
I prefer FIX 1 since it is more compact and covers all the varargs
programs I can think of. It would be reasonable to require
that the '...' must appear last (to simplify implementation).
Tom Truscott
More information about the Comp.lang.c
mailing list