Messages in this thread | | | Date | Mon, 2 Jun 2008 11:38:36 +0200 | From | "Vegard Nossum" <> | Subject | Re: optimizing out inline functions |
| |
On Thu, May 29, 2008 at 6:39 PM, Steve French <smfrench@gmail.com> wrote: > Ran into one loosely related question, printk takes a variable > argument list, so the calling function in this case would also need to > be able to handle thos variable arguments. With macros, we are able > to do things like with variable arguments easily > > #define function_to_print_some_warning(format, arg...) > printk(KERN_WARNING ": " format "\n" , ## arg) > > Are there style rules (or nicely written examples) for doing this > (variable argument lists) with (inline) functions >
Hm, are you referring to making a proxy inline function that takes a variable number of arguments and calls another function with the same (also variable number of) variables?
I don't think this is possible unless you want to use va_lists. And that might not be desirable in an inline function, I don't know how well gcc can optimize this away.
The canonical example, although not an inline function, is printk() itself from kernel/printk.c, which simply calls vprintk().
Vegard
-- "The animistic metaphor of the bug that maliciously sneaked in while the programmer was not looking is intellectually dishonest as it disguises that the error is the programmer's own creation." -- E. W. Dijkstra, EWD1036
| |