[Zlib-devel] zlib 1.2.3.5 available for testing
Mark Adler
madler at alumni.caltech.edu
Fri Jan 8 22:13:20 EST 2010
On Jan 8, 2010, at 2:11 AM, Török Edwin wrote:
> 1. Portability
> gzread.c:425:13: warning: use of GNU void* extension [-Wpointer-arith]
> buf += n;
> ~~~ ^ ~
>
> gzwrite.c:195:17: warning: use of GNU void* extension [-Wpointer-arith]
> buf += n;
> ~~~ ^ ~
What I had there before which worked fine a few years ago was:
(char *)buf += n;
Makes sense, right? Well now I get a nastygram from the compiler for that: "warning: target of assignment not really an lvalue; this will be a hard error in the future." So I changed it to:
buf += n;
but apparently some compilers hate that as well. It used to be that any self-respecting compiler knew what you meant when you did arithmetic on a void * pointer, i.e. that you meant for the units to be bytes. And I have no idea why (char *)buf, a cast of a pointer to another pointer type, is no longer a pointer. Why there has been such a vicious attack on the expressiveness of C, I have no idea. I blame it all on religious extremists. Anyway, I digress. Please try this in those two places:
buf = (char *)buf + n;
and let me know what complaint you get then. Thanks.
Mark
More information about the Zlib-devel
mailing list