Inlining of vararg functions

Dale Johannesen dalej@apple.com
Thu May 3 10:05:00 GMT 2001


On Thursday, May 3, 2001, at 02:09  AM, Nathan Sidwell wrote:

> 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.

True, but optimization thereafter could reduce many cases to simpler 
code.  Actually this is probably one of the highest-win situations for 
inlining in terms of how much improvement you get, but because of the 
difficulty of doing it and the low probability of occurrence, most 
compilers don't.  There is no theoretical reason it can't work.



More information about the Gcc mailing list