[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <19f34abd0806020238h2eba8765la3764b15211a205@mail.gmail.com>
Date: Mon, 2 Jun 2008 11:38:36 +0200
From: "Vegard Nossum" <vegard.nossum@...il.com>
To: "Steve French" <smfrench@...il.com>
Cc: "Sam Ravnborg" <sam@...nborg.org>,
lkml <linux-kernel@...r.kernel.org>
Subject: Re: optimizing out inline functions
On Thu, May 29, 2008 at 6:39 PM, Steve French <smfrench@...il.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists