[Zlib-devel] zlib 1.2.3.5 available for testing
Vincent Torri
vtorri at univ-evry.fr
Sat Jan 9 02:23:59 EST 2010
On Fri, 8 Jan 2010, Mark Adler wrote:
> 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;
>> ~~~ ^ ~
pointer arithmetic on void * is a gcc extension. It may give wrong results
on other platforms (for exemple opensolaris using suncc, Enlightenment
was not working because of that). Add -pedantic tovCFLAGS (when compiling
with gcc). It removes the use of gcc extension andvyou'll see the warnings
just change the declaration of buf to be a char * instead of a void *
Vincent Torri
>
> 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
>
>
> _______________________________________________
> Zlib-devel mailing list
> Zlib-devel at madler.net
> http://mail.madler.net/mailman/listinfo/zlib-devel_madler.net
>
>
More information about the Zlib-devel
mailing list