This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Creating a va_list dynamically?
- To: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- Subject: Re: Creating a va_list dynamically?
- From: Kevin Handy <kth at srv dot net>
- Date: Tue, 10 Oct 2000 08:42:21 -0600
- CC: gcc at gcc dot gnu dot org
- Organization: Software Solutions, Inc
- References: <200010091722.NAA19861@caip.rutgers.edu>
"Kaveh R. Ghazi" wrote:
>
> Is it possible to dynamically and portably create a va_list?
>
> I'm trying to see if I can easily teach gcc to optimize e.g.
>
> > fprintf("%d %s", 5, "hello") -> fputs("5 hello")
Shouldn't there be a channel in these two functions?
> What I'd like to do is, at compile time, take the tree structures
> representing 5 and "hello" and dynamically create a va_list out of
> them. Then I'd pass the format arg and the va_list to vasprintf() and
> emit a call to fputs with the resulting string.
What about the cases where there is a mix of constants and
variables?
printf("%d %s %s\n", i, "Hello", "World")
could be simplified to
printf("%d Hello World\n", i);
but I don't know how much gain this type of optimization would be.
> (If I can't use something like vasprintf, I'd have to rewrite a
> complete *printf parser. Bleah.)
>
> Any info would be appreciated.