This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH: Use "%I64d" on Windows
On Wed, 24 Nov 2004, Jakub Jelinek wrote:
> On Tue, Nov 23, 2004 at 08:35:00PM -0800, Mark Mitchell wrote:
> >
> > The Windows C library uses "%I64d", not "%lld", to print arguments of
> > type "long long".
> >
> > GCC will complain that this is an unknown printf-format on Windows;
> > the fix will be to use the machinery added for Solaris 10 to handle
> > the various Windows-specific formats.
>
> Yeah, that's necessary, as e.g. for glibc %I64d means the same as
> %64d, but using locale digits instead of 0..9.
Which would also make it difficult to support the Windows format as a
target-specific printf format; the machinery adds additional formats to
the standard "printf", "scanf", "strftime", "strfmon" rather than
modifying those.
I think that for 4.1 we should move away from all use of *printf with the
HOST_WIDE_INT-type formats. The pretty-printing/diagnostic machinery
should be made usable by all host programs (not just cc1 etc.); the
pretty-printing machinery should have suitable wrappers added with the
effect of fprintf/sprintf/asprintf etc. but allowing GCC-specific formats;
and GCC-specific number formatting code (like Zack's in dbxout.c) could be
used within the diagnostic code and within asm_fprintf to avoid such
dependence on the host's printf. (We also get rid of HOST_PTR_PRINTF this
way.)
--
Joseph S. Myers http://www.srcf.ucam.org/~jsm28/gcc/
jsm@polyomino.org.uk (personal mail)
joseph@codesourcery.com (CodeSourcery mail)
jsm28@gcc.gnu.org (Bugzilla assignments and CCs)