This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [PATCH] Trivial printf format warning fixes
- From: Andreas Jaeger <aj at suse dot de>
- To: Eli Zaretskii <eliz at is dot elta dot co dot il>
- Cc: Jason R Thorpe <thorpej at wasabisystems dot com>,gdb-patches at sources dot redhat dot com
- Date: Tue, 23 Apr 2002 08:20:26 +0200
- Subject: Re: [PATCH] Trivial printf format warning fixes
- References: <Pine.SUN.3.91.1020423100505.22959J@is>
Eli Zaretskii <eliz@is.elta.co.il> writes:
> On Mon, 22 Apr 2002, Jason R Thorpe wrote:
>
>> error ("Syntax error at prompt position %d",
>> - promptp - local_prompt);
>> + (int) (promptp - local_prompt));
>
> I think the result of subtracting two pointers can be wider than an int,
> can't it? If so, casting to an int is not right, and the format should
> be changed to %ld.
ISO C99 introduced 't' for ptrdiff_t, so we could use '%td' here if we
have an ISO C99 compiler.
> (Yes, this is nitpicking, but if we are to fix this warning, might as
> well do it right ;-)
Andreas
--
Andreas Jaeger
SuSE Labs aj@suse.de
private aj@arthur.inka.de
http://www.suse.de/~aj