possible fix for varargs problem
Robert Berlinger
naftoli at aecom.UUCP
Sat Jan 14 01:56:37 AEST 1984
After having read all the problems with variable arguments I have
a possible "fix" that might be implemented and would be portable
to any environment that support sprintf.
All that need by done is to modify the C preprocessor to allow
variable argument macros. This way you could declare something
like:
#define error(vargs) sprintf(buffer, vargs); real_error_routine(buffer)
and have the preprocessor pass along the proper args to sprintf.
Why not call sprintf directly? Well of course you could, but
you'd have to do all that typeing. This would save a lot of work,
and would make it seem as if C "allowed" variable argument
routines. Of course you're not going to save any space text
wise, as you would if you could bury the sprintf in the error
routine. But I do think that the convenience would be worth. I
have no idea as to the implementation details and any change to
the preprocessor (or any other part of C) is asking for trouble
but I might as well speak my peace anyway.
--
Robert Berlinger
...{philabs,cucard,pegasus}!aecom!naftoli
"If you're not where you are, you're nowhere"
More information about the Comp.lang.c
mailing list