IMPORTANT If you decide to try the following codes, please do so at your own risk.
If the program is out of control and you are in trouble, press <Ctrl-C> to stop it.
A variadic function
# define __cdecl
# include <stdio.h>
# include <stdarg.h>
signed(__cdecl f_r(signed(arg),signed(*argp))) {
auto signed r;
if(!(0x00<(arg))) return(0x00);
--arg;
r = (*argp);
printf("%p [%02d] \n",argp,r);
r = (sizeof(argp));
r = (r/(sizeof(*argp)));
argp = (r+(argp));
return(0x01+(f_r(arg,argp)));
}
signed(__cdecl f(signed arg,...)) {
auto signed *b;
auto signed r;
b = (&arg);
r = (sizeof(b));
r = (r/(sizeof(*b)));
b = (r+(b));
r = f_r(arg,b);
printf("r: [%d] \n",r);
return(r);
}
signed(__cdecl main(void)) {
auto signed r;
r = (10);
r = f(r,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15);
printf("r: [%d] \n",r);
printf("Done! \n");
return(0x00);
}
Remarks:
Replace
# define __cdecl
with
# define __cdecl __attribute__((ms_abi))
if you compile the above source code with GCC on WSL.