Re: [RFC] convert a host address to a string

Kai Tietz
2009-01-08T11:31:01Z

Hi Joel,

gdb-patches-owner@sourceware.org wrote on 08.01.2009 12:24:48:

> > By it you can use standard ISO type intptr_t. And I missed to add
> > inttypes.h.
> > By this you could simply use PRIXPTR for printing hex pointer failues.
> >
> > E.g.
> > fprint (fp, "0x%" PRIXPTR, (intptr_t) address);
>
> That's pretty clever. Bad luck for us, however. The MinGW inttypes.h
> defines PRIxPTR as "I64x". When I tried with an example, I got a warning
> because intptr_t is "long long int" whereas "%I64x" requires an unsigned
> int. Changing the cast to uintptr_t helps a little, but it's not enough
> since "unsigned int" is definitely not large enough to hold a pointer!
>
> I really should report that to the MinGW guys!

Ok, I got it. But there is not much to do here. I am a bit curious about
that x wants an unsigned scalar. I have to verify this.
The alternative for this, would be to cast to size_t in general.

Cheers,
Kai

| (\_/) This is Bunny. Copy and paste Bunny
| (='.'=) into your signature to help him gain
| (")_(") world domination.