You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by jean-frederic clere <jf...@gmail.com> on 2007/10/30 11:05:16 UTC
Re: svn commit: r589846 - /apr/apr/trunk/file_io/unix/fullrw.c
trawick@apache.org wrote:
> Author: trawick
> Date: Mon Oct 29 13:36:08 2007
> New Revision: 589846
>
> URL: http://svn.apache.org/viewvc?rev=589846&view=rev
> Log:
> AIX C compiler won't add to void * in picky mode
It seems I also had problems on HP-UX:
+++
if (amt) {
<<<<<<< .mine
/* rv = apr_file_write_full(thefile, vec[i].iov_base + amt, */
void *ptr = vec[i].iov_base;
ptr = ptr + amt;
rv = apr_file_write_full(thefile, ptr,
=======
rv = apr_file_write_full(thefile, (const char *)vec[i].iov_base
+ amt,
>>>>>>> .r589986
vec[i].iov_len - amt, NULL);
}
+++
>
> Modified:
> apr/apr/trunk/file_io/unix/fullrw.c
>
> Modified: apr/apr/trunk/file_io/unix/fullrw.c
> URL: http://svn.apache.org/viewvc/apr/apr/trunk/file_io/unix/fullrw.c?rev=589846&r1=589845&r2=589846&view=diff
> ==============================================================================
> --- apr/apr/trunk/file_io/unix/fullrw.c (original)
> +++ apr/apr/trunk/file_io/unix/fullrw.c Mon Oct 29 13:36:08 2007
> @@ -95,7 +95,7 @@
> }
>
> if (amt) {
> - rv = apr_file_write_full(thefile, vec[i].iov_base + amt,
> + rv = apr_file_write_full(thefile, (const char *)vec[i].iov_base + amt,
> vec[i].iov_len - amt, NULL);
> }
>
>
>
>
Re: svn commit: r589846 - /apr/apr/trunk/file_io/unix/fullrw.c
Posted by Davi Arnaut <da...@apache.org>.
Lucian Adrian Grijincu wrote:
> On 10/30/07, jean-frederic clere <jf...@gmail.com> wrote:
>> trawick@apache.org wrote:
>>> Author: trawick
>>> Date: Mon Oct 29 13:36:08 2007
>>> New Revision: 589846
>>>
>>> URL: http://svn.apache.org/viewvc?rev=589846&view=rev
>>> Log:
>>> AIX C compiler won't add to void * in picky mode
>> It seems I also had problems on HP-UX:
>> +++
>> if (amt) {
>> <<<<<<< .mine
>> /* rv = apr_file_write_full(thefile, vec[i].iov_base + amt, */
>> void *ptr = vec[i].iov_base;
>> ptr = ptr + amt;
>> rv = apr_file_write_full(thefile, ptr,
>> =======
>
>
> does the C standard allow void* arithmetics?
>
No, it's a handy GNU extension. Arithmetic cannot be performed on void
pointers because the void type has no size. GCC can issue warnings such
for such:
-Wpointer-arith
Warn about anything that depends on the ``size of'' a function type or
of "void". GNU C assigns these types a size of 1, for convenience in
calculations with "void *" pointers and pointers to functions.
--
Davi Arnaut
Re: svn commit: r589846 - /apr/apr/trunk/file_io/unix/fullrw.c
Posted by Jim Jagielski <ji...@jaguNET.com>.
On Oct 30, 2007, at 6:17 AM, Lucian Adrian Grijincu wrote:
> On 10/30/07, jean-frederic clere <jf...@gmail.com> wrote:
>> trawick@apache.org wrote:
>>> Author: trawick
>>> Date: Mon Oct 29 13:36:08 2007
>>> New Revision: 589846
>>>
>>> URL: http://svn.apache.org/viewvc?rev=589846&view=rev
>>> Log:
>>> AIX C compiler won't add to void * in picky mode
>>
>> It seems I also had problems on HP-UX:
>> +++
>> if (amt) {
>> <<<<<<< .mine
>> /* rv = apr_file_write_full(thefile, vec[i].iov_base +
>> amt, */
>> void *ptr = vec[i].iov_base;
>> ptr = ptr + amt;
>> rv = apr_file_write_full(thefile, ptr,
>> =======
>
>
> does the C standard allow void* arithmetics?
>
No, because when incrementing how does one know how much to
increment it...? C is smart enough to know how much to "really"
move the pointer with p += 1 depending on what p is actually pointing
to; but with void, there is no real "size" associated with it.
Re: svn commit: r589846 - /apr/apr/trunk/file_io/unix/fullrw.c
Posted by jean-frederic clere <jf...@gmail.com>.
Lucian Adrian Grijincu wrote:
> On 10/30/07, jean-frederic clere <jf...@gmail.com> wrote:
>> trawick@apache.org wrote:
>>> Author: trawick
>>> Date: Mon Oct 29 13:36:08 2007
>>> New Revision: 589846
>>>
>>> URL: http://svn.apache.org/viewvc?rev=589846&view=rev
>>> Log:
>>> AIX C compiler won't add to void * in picky mode
>> It seems I also had problems on HP-UX:
>> +++
>> if (amt) {
>> <<<<<<< .mine
>> /* rv = apr_file_write_full(thefile, vec[i].iov_base + amt, */
>> void *ptr = vec[i].iov_base;
>> ptr = ptr + amt;
>> rv = apr_file_write_full(thefile, ptr,
>> =======
>
>
> does the C standard allow void* arithmetics?
>
> won't this compile for you:
> const char *ptr = (const char*) vec[i].iov_base;
> ptr = ptr + amt;
> rv = apr_file_write_full(thefile, ptr,
>
> ?
Yep, this one compiles the void * version doesn't.
Cheers
Jean-Frederic
>
>> rv = apr_file_write_full(thefile, (const char *)vec[i].iov_base
>> + amt,
>>>>>>>>> .r589986
>> vec[i].iov_len - amt, NULL);
>> }
>> +++
>>
>>> Modified:
>>> apr/apr/trunk/file_io/unix/fullrw.c
>>>
>>> Modified: apr/apr/trunk/file_io/unix/fullrw.c
>>> URL: http://svn.apache.org/viewvc/apr/apr/trunk/file_io/unix/fullrw.c?rev=589846&r1=589845&r2=589846&view=diff
>>> ==============================================================================
>>> --- apr/apr/trunk/file_io/unix/fullrw.c (original)
>>> +++ apr/apr/trunk/file_io/unix/fullrw.c Mon Oct 29 13:36:08 2007
>>> @@ -95,7 +95,7 @@
>>> }
>>>
>>> if (amt) {
>>> - rv = apr_file_write_full(thefile, vec[i].iov_base + amt,
>>> + rv = apr_file_write_full(thefile, (const char *)vec[i].iov_base + amt,
>>> vec[i].iov_len - amt, NULL);
>>> }
>>>
>>>
>>>
>>>
>>
>
>
Re: svn commit: r589846 - /apr/apr/trunk/file_io/unix/fullrw.c
Posted by Lucian Adrian Grijincu <lu...@gmail.com>.
On 10/30/07, jean-frederic clere <jf...@gmail.com> wrote:
> trawick@apache.org wrote:
> > Author: trawick
> > Date: Mon Oct 29 13:36:08 2007
> > New Revision: 589846
> >
> > URL: http://svn.apache.org/viewvc?rev=589846&view=rev
> > Log:
> > AIX C compiler won't add to void * in picky mode
>
> It seems I also had problems on HP-UX:
> +++
> if (amt) {
> <<<<<<< .mine
> /* rv = apr_file_write_full(thefile, vec[i].iov_base + amt, */
> void *ptr = vec[i].iov_base;
> ptr = ptr + amt;
> rv = apr_file_write_full(thefile, ptr,
> =======
does the C standard allow void* arithmetics?
won't this compile for you:
const char *ptr = (const char*) vec[i].iov_base;
ptr = ptr + amt;
rv = apr_file_write_full(thefile, ptr,
?
> rv = apr_file_write_full(thefile, (const char *)vec[i].iov_base
> + amt,
> >>>>>>> .r589986
> vec[i].iov_len - amt, NULL);
> }
> +++
>
> >
> > Modified:
> > apr/apr/trunk/file_io/unix/fullrw.c
> >
> > Modified: apr/apr/trunk/file_io/unix/fullrw.c
> > URL: http://svn.apache.org/viewvc/apr/apr/trunk/file_io/unix/fullrw.c?rev=589846&r1=589845&r2=589846&view=diff
> > ==============================================================================
> > --- apr/apr/trunk/file_io/unix/fullrw.c (original)
> > +++ apr/apr/trunk/file_io/unix/fullrw.c Mon Oct 29 13:36:08 2007
> > @@ -95,7 +95,7 @@
> > }
> >
> > if (amt) {
> > - rv = apr_file_write_full(thefile, vec[i].iov_base + amt,
> > + rv = apr_file_write_full(thefile, (const char *)vec[i].iov_base + amt,
> > vec[i].iov_len - amt, NULL);
> > }
> >
> >
> >
> >
>
>
--
Lucian
Re: svn commit: r589846 - /apr/apr/trunk/file_io/unix/fullrw.c
Posted by jean-frederic clere <jf...@gmail.com>.
Jeff Trawick wrote:
> On 10/30/07, jean-frederic clere <jf...@gmail.com> wrote:
>> trawick@apache.org wrote:
>>> Author: trawick
>>> Date: Mon Oct 29 13:36:08 2007
>>> New Revision: 589846
>>>
>>> URL: http://svn.apache.org/viewvc?rev=589846&view=rev
>>> Log:
>>> AIX C compiler won't add to void * in picky mode
>> It seems I also had problems on HP-UX:
>
> I wondered about that one... In the old days I had build/test
> regression set up on a bunch of boxes... AIX, HP-UX, and Tru64 with
> the native compilers would generally barf in lock step.
>
Without you correction it says:
+++
$ make
/usr/bin/posix/sh /qa/home/jfclere/TMP/dev25/apr-trunk/libtool
--silent --mode=compile cc -g -Ae +Z -mt -DHAVE_CONFIG_H -DHPUX11
-D_REENTRANT -D_HPUX_SOURCE -D_LARGEFILE64_SOURCE -I./include
-I/qa/home/jfclere/TMP/dev25/apr-trunk/include/arch/unix
-I./include/arch/unix -I/qa/home/jfclere/TMP/dev25/apr-trunk/include -o
file_io/unix/fullrw.lo -c file_io/unix/fullrw.c && touch
file_io/unix/fullrw.lo
"file_io/unix/fullrw.c", line 98: error #2852: expression must be a
pointer to
a complete object type
rv = apr_file_write_full(thefile, vec[i].iov_base + amt,
^
1 error detected in the compilation of "file_io/unix/fullrw.c".
*** Error exit code 1
Stop.
*** Error exit code 1
Cheers
Jean-Frederic
Stop.
+++
Re: svn commit: r589846 - /apr/apr/trunk/file_io/unix/fullrw.c
Posted by Jeff Trawick <tr...@gmail.com>.
On 10/30/07, jean-frederic clere <jf...@gmail.com> wrote:
> trawick@apache.org wrote:
> > Author: trawick
> > Date: Mon Oct 29 13:36:08 2007
> > New Revision: 589846
> >
> > URL: http://svn.apache.org/viewvc?rev=589846&view=rev
> > Log:
> > AIX C compiler won't add to void * in picky mode
>
> It seems I also had problems on HP-UX:
I wondered about that one... In the old days I had build/test
regression set up on a bunch of boxes... AIX, HP-UX, and Tru64 with
the native compilers would generally barf in lock step.