This is the mail archive of the
mailing list for the GCC project.
Re: Patch to add __builtin_printf -> fputs transformations
- To: jsm28 at cam dot ac dot uk
- Subject: Re: Patch to add __builtin_printf -> fputs transformations
- From: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- Date: Wed, 20 Sep 2000 14:44:51 -0400 (EDT)
- Cc: gcc-patches at gcc dot gnu dot org
> From: "Joseph S. Myers" <firstname.lastname@example.org>
> Some warnings on the more general optimisations:
> Concatenating format specifiers won't work if $ operand numbers are
> used. Setting pedantic prevents printf optimisations from looking at such
> formats for now, but it's something to be aware of in case a future C
> standard adds $ formats.
> %n formats also prevent concatenation.
> All the usual cross-compilation issues of getting the right output for the
> target system apply.
> Floating point conversions should follow the runtime rounding mode - at
> least within #pragma STDC FENV_ACCESS ON.
> NaNs and infinities should be passed to the library for it to format in
> its implementation-defined style. Likewise, %p should also be passed to
> the library at runtime.
> %lc and %ls formats depend on the runtime locale.
Okay let's say I want to start with low hanging fruit. I.e. not
having to worry about any of the above things like cross-compile, or
locale or whatever when evaluating printf at compile time. Which
specifiers (with constant arguments) *are* allowed without regard to
I assume "%c" and "%s" with constant args are always okay?
How about integer specifiers? I.e. are "%d", "%lx", etc. affected by
locale or other runtime env issues?
Similar question applies to concatenation. Which specifiers are
explicitly always allowed?
Kaveh R. Ghazi Engagement Manager / Project Services
email@example.com Qwest Internet Solutions