C, variadic functions and stdarg.h -


i found code on codegolf.stackexchange site.

#include <stdio.h> #define function int #define var int struct { int (*log)(const char *,...); } console = { printf };  /* here on javascript! */  function fac(x){     if(x < 2) return 1;     return x * fac(x - 1); }  function main(){     console.log("hello world!\n");      for(var = 0; < 10; i++){         console.log("%i! = %i\n", i, fac(i));     }      return 0; }  // *should* export main function of library??/ exports.main = main; 

my question is, how able run variadic function without including stdarg.h?

because not manipulating ... parameter, passing pointer function internally manipulates ... parameter, in case printf:

int __cdecl printf(const char *_format, ...); 

note: not compilers support __cdecl calling convention.

aswell, macros has defined pointless , should not used under circumstance, not c.


Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -