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 char(**argp))) {
auto signed char *b;
if(!argp) return(0x00);
if(!(*argp)) return(0x00);
b = (*argp);
argp++;
printf("%s",b);
return(0x01+(f_r(argp)));
}
signed(__cdecl f(signed char *argp,...)) {
auto signed char **v;
if(!argp) return(0x00);
v = (&argp);
return(f_r(v));
}
signed(__cdecl main(void)) {
auto signed char *b;
auto signed r;
b = (0x00);
r = f("Hi,"," ","there!","\n",b);
if(!r) printf("Oops..\n");
return(0x00);
}
Remarks:
Add
# define __cdecl __attribute__((ms_abi))
and remove
# define __cdecl
if you compile the above source code with GCC on WSL.