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



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.


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