How to use R’s ellipsis feature when writing your own function?

The R language has a nifty feature for defining functions that can take a variable number of arguments. For example, the function data.frame takes any number of arguments, and each argument becomes the data for a column in the resulting data table. Example usage: > data.frame(letters=c(“a”, “b”, “c”), numbers=c(1,2,3), notes=c(“do”, “re”, “mi”)) letters numbers notes … Read more

Forward an invocation of a variadic function in C

In C, is it possible to forward the invocation of a variadic function? As in, int my_printf(char *fmt, …) { fprintf(stderr, “Calling printf with fmt %s”, fmt); return SOMEHOW_INVOKE_LIBC_PRINTF; } Forwarding the invocation in the manner above obviously isn’t strictly necessary in this case (since you could log invocations in other ways, or use vfprintf), … Read more