CBFalconer said:
... snip ...
Such arguments are immediately assigned to the appropriate nameless
parameter.
Umh, I am not sure what you mean. Maybe there is a
misunderstanding. Say, we have the following "program":
___________________________________________
#include <stdarg.h>
#include <stdio.h>
int foo (int is_intptr, void *ptr);
int bar (int howmany, ...);
int main (void)
{
int baz = 77;
printf("foo: %d\t", foo(1, &baz));
printf("baz: %d\n", baz);
return 0;
}
int foo (int is_intptr, void *ptr)
{
if (is_intptr)
return bar(1,(int *) ptr); /*<---*/
else
return -1;
}
int bar (int howmany, ...)
{
int m, *p;
va_list args;
va_start(args, howmany);
m = 0;
while (0 < howmany--) {
p = va_arg(args, int *);
m += *p - *p%42;
*p |= m;
}
va_end(args);
return m&0x42;
}
___________________________________________
Would you leave out the cast at the marked line in foo()?
If yes: What if the representations of (void *)&baz and
(int *)&baz were different?
Cheers
Michael