OK, thanks to everyone, I followed the direction that you gave me, and this solution: As far as I understand, there is no general / portable solution to the problem of getting a variable number of arguments and passing them to another function that takes a variable number of arguments (as http mentioned to it : //c-faq.com/varargs/handoff.html ).
But I wanted to implement an alternative to NSLog (I call it AliLog), which behaves like NSLog during debugging, but does nothing for the release version (or does something other than writing to the console).
here is my solution:
void AliLog(NSString *format, ...) { #ifdef DEBUG va_list args; va_start(args, format); NSLogv(format, args); va_end(args); #else
The magic is in NSLogv here.
source share