lkml.org 
[lkml]   [2008]   [Jun]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: 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


\
 
 \ /
  Last update: 2008-06-02 11:41    [W:0.059 / U:0.592 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site