Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: Errors compiling on HP-UX with HP's compiler
On 2010-12-20 06:00:37 +0000, Paul Ackersviller wrote:
> I must be using gcc more often than not to have just run across this.
> HP's compiler, I think rightly, refuses to do arithmetic on these two
> void pointers. Does gcc treat them as char * for that purpose?
This is a well-known GCC extension:
5.21 Arithmetic on `void'- and Function-Pointers
================================================
In GNU C, addition and subtraction operations are supported on pointers
to `void' and on pointers to functions. This is done by treating the
size of a `void' or of a function as 1.
A consequence of this is that `sizeof' is also allowed on `void' and
on function types, and returns 1.
The option `-Wpointer-arith' requests a warning if these extensions
are used.
--
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / Arénaire project (LIP, ENS-Lyon)
Messages sorted by:
Reverse Date,
Date,
Thread,
Author