This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Patch for bfd/cache.c - explicit cast to void*
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: Jerker Bäck <jerker dot back at gmail dot com>
- Cc: binutils at sourceware dot org
- Date: Sun, 1 Mar 2009 10:03:23 +1030
- Subject: Re: Patch for bfd/cache.c - explicit cast to void*
- References: <49a9869e.06e9300a.4fae.5455@mx.google.com>
On Sat, Feb 28, 2009 at 07:46:53PM +0100, Jerker Bäck wrote:
> I suggest the attached patch to bfd/cache.c.
>
>
> This patch gives explicit cast from integer value to void*.
>
> -chunk_nread = cache_bread_1(abfd, (char*)buf + nread, chunk_size);
> +chunk_nread = cache_bread_1(abfd, (void*)((file_ptr)buf + nread),
> chunk_size);
>
> My compiler refuse to compile the current source - just to make it work.
I don't see why you need this. "buf" is a void *,
"(char *) buf + nread" is a char *, which should be acceptable as a
void * parameter to cache_bread_1 without an explicit case. In fact,
adding a file_ptr cast might well introduce a warning about casting
a pointer to a different size integer.
--
Alan Modra
Australia Development Lab, IBM