6 ms·
What I would like in C is a way to specify an argument list. And be able to slop them around and call functions with them later. So perhaps foo(args) means foo
by Gibbon1 8y ago
What I would like in C is a way to specify an argument list. And be able to slop them around and call functions with them later.
So perhaps foo(args) means foo takes a list of arguments unspecified.
- nitrogen 8y agoYou can approximate an argument list using compound literals as long as 0/NULL is an acceptable default value. It's a bit noisy, but it works something like this if I remember right: result = foo(&(struct foo_args){.arg1 = 4, .arg7 = "2"})
- ndesaulniers 8y agohttp://nickdesaulniers.github.io/blog/2013/07/25/designated-initialization-with-pointers-in-c/ http://nickdesaulniers.github.io/blog/2013/07/25/designated-...
- unilynx 8y agoLike va_list in vprintf ?
- kazinator 8y agoThere are libraries for this like GNU ffcall and libffi.
- Gibbon1 8y agoLooked at those. Problem with libffi is it wasn't ported to a 32 bit arm. And the interface is 'clunkie' I think what I want is llvm's blocks. Which isn't available in gcc.