This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Inlining of vararg functions


Peter Simons wrote:
> 
> Hi,
> 
> just a few moments ago, I realized that gcc apparently cannot inline
> functions with variable arguments such as "void test(char*, ...)". Is
> there any particular reason why this is so? And is there any chance
> that this feature will be added to gcc (3.0?) in the near future? Do
> you by chance know whether other compilers can do this?
I think it quite unlikely that this will happen. With varadic functions,
the compiler has no knowledge of how the arguments are going to be
accessed (it's isomorphic to the halting problem). they essentially have
to be layed down in an array and accessed via a pointer. That
would have to still be done on inlining, and I suspect it would get
hairy.

The one exception would be the empty function
	void foo (char *, ...)
	{
	}

which I guess might happen for debug type things with debugging disabled.

my feeling is that it is sufficiently rare for a varadic function call
to be worth inlining in the first place, that implementing that functionallity
would not be worth it.

nathan

-- 
Dr Nathan Sidwell   ::   http://www.codesourcery.com   ::   CodeSourcery LLC
         'But that's a lie.' - 'Yes it is. What's your point?'
nathan@codesourcery.com : http://www.cs.bris.ac.uk/~nathan/ : nathan@acm.org


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]