This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Inlining of vararg functions
- To: Nathan Sidwell <nathan at codesourcery dot com>
- Subject: Re: Inlining of vararg functions
- From: Dale Johannesen <dalej at apple dot com>
- Date: Thu, 3 May 2001 10:05:52 -0700
- Cc: Peter Simons <peter dot simons at cw dot com>, gcc at gcc dot gnu dot org
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.