This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [RFC] Use %p conversion specifier to fix hppa compiler warning
- From: Eli Zaretskii <eliz at gnu dot org>
- To: Mark Kettenis <mark dot kettenis at xs4all dot nl>
- Cc: gdb-patches at sources dot redhat dot com
- Date: Mon, 13 Jun 2005 09:12:07 +0300
- Subject: Re: [RFC] Use %p conversion specifier to fix hppa compiler warning
- References: <200506122102.j5CL2FPB002032@elgar.sibelius.xs4all.nl>
- Reply-to: Eli Zaretskii <eliz at gnu dot org>
> Date: Sun, 12 Jun 2005 23:02:15 +0200 (CEST)
> From: Mark Kettenis <mark.kettenis@xs4all.nl>
>
> Currently the compiler warns about hppa_pointer_to_address_hack().
> Rather than adding ugly casts and making this an even worse hack, I
> propose to remove it completely in favour of using the %p format
> specifier.
>
> In the past we didn't use the %p conversion specifier since it wasn't
> portable; ancient UNIX didn't support it. However, I'm confident that
> we do not support those systems any more. I've done some archeology,
> and it seems %p is supported by Ultrix 4.0, HP-UX 10.01 and SunOS
> 4.1.3.
%p is ANSI/ISO C89, IIRC, so we can use it freely. The one problem
with it is that its results are inconsistent: some libraries produce
"0x" before the address, others don't. This is a minor inconsistency,
but with some numerical values, if you don't have the telltale "0x",
you may wonder whether the number is in hex or decimal.