On Mon, May 16, 2005 at 09:36:32PM +0000, Tuomo Valkonen wrote:
> On 2005-05-16, tom fogal <[EMAIL PROTECTED]> wrote:
> > This is with an amd64 system. Ion is working fine for me on another
> > similarly setup amd64 system; I suspect it was compiled with a compiler
> > closer to gcc3.0, and what I'm seeing here is gcc3.4.3 being more
> > strict about the standard.
> 
> Either your compiler is broken or the standard is a stinking pile of crap;
> all conversions between void and function pointers in the code are explicit.

gcc is being very strict, but correct. -pedantic-errors makes it throw an
error instead of just a warning in this case.

The reason that it's complaining is that, in C, data pointers are not
nescessarily the same size as function pointers. Those of you who remember
the good old days of DOS programming will remember the different memory
models. Differrent memory models caused code and data pointers to be
different sizes, e.g. a large program that did not require much of memory
might choose 32-bit code pointers but 16-bit data pointers (this was called
the medium memory model). Therefore you couldn't actually store the address
of a function in a void *. Doing an explicit cast doesn't help: you still
don't have room to store the function pointer.

On most systems these days code and data pointers are the same size, but
it's not guaranteed. gcc is just warning you of a potential problem.

There are a few little historic artifacts in C, and some weird
architectures. On some systems a byte is not 8 bits, and NULL != (void*)0
(i.e. code like x=malloc(...); if(!x) { ... } breaks).
-- 
Tom

Reply via email to