This is the mail archive of the
mailing list for the GDB project.
Re: [PATCH] long long for printf on MinGW
- From: Daniel Jacobowitz <drow at false dot org>
- To: Andrew STUBBS <andrew dot stubbs at st dot com>
- Cc: GDB Patches <gdb-patches at sourceware dot org>
- Date: Tue, 22 Apr 2008 14:02:04 -0400
- Subject: Re: [PATCH] long long for printf on MinGW
- References: <452CCE2D.firstname.lastname@example.org> <20061011130330.GA24187@nevyn.them.org> <452D09E8.email@example.com>
On Wed, Oct 11, 2006 at 04:12:40PM +0100, Andrew STUBBS wrote:
> 2006-10-11 Andrew Stubbs <firstname.lastname@example.org>
> * printcmd.c: Define USE_PRINTF_I64 and PRINTF_HAS_LONG_LONG on MinGW.
> (printf_command): Convert %lld to %I64d when USE_PRINTF_I64 set.
I'm somewhat willing to approve this patch. Note this is the revised
I had ambitious plans involving making printf work on target types.
But they aren't going to come through any time soon.
However, for host types we could import the printf (vsprintf-posix)
module from gnulib, then always assume PRINTF_HAS_LONG_LONG as long as
HAVE_LONG_LONG_INT. I did the work of adding gnulib modules already.
So maybe this is a better option. What do you think?
> + /* Windows' printf does support long long, but not the usual way.
> + Convert %lld to %I64d. */
> + int length_before_ll = f - last_arg - 1 - lcount;
> + strncpy (current_substring, last_arg, length_before_ll);
> + strcpy (current_substring + length_before_ll, "I64");
> + current_substring[length_before_ll + 3] =
> + last_arg[length_before_ll + lcount];
> + current_substring += length_before_ll + 4;
You've got enough buffer space to do this but I had to think about it
a couple times to work out why :-)