Re: [Exim] warning: cast from pointer to integer of differen…

Pàgina inicial
Delete this message
Reply to this message
Autor: Kjetil Torgrim Homme
Data:  
A: exim-users
Assumpte: Re: [Exim] warning: cast from pointer to integer of different size
On Mon, 2003-12-22 at 13:03, Philip Hazel wrote:
> On Sun, 21 Dec 2003, Scott wrote:
>
> > I am getting -- warning: cast from pointer to integer of different size
> > when compiling Exim and the monitor program on an AMD64. Mandrake Corp. 2.1
> > x86_64
> > This is with Exim v4.30.


in Linux x86-64, ints are 32 bits, and pointers (and longs) are 64 bits.

> > filter.c: In function `interpret_commands':
> > filter.c:1900: warning: cast from pointer to integer of different size
>
> That line is
>
>     mode = (int)(commands->args[1]);

>
> There's an explicit cast ("(int)") in that statement which says "I know
> what I'm doing here, copying this into an int", but the compiler still
> complains. I do not know of any way of stopping this, short of using a
> union instead of (void *) to hold "data of unspecified type". The
> annoyance with a union is that you then have to enumerate all the
> different types.


I guess I have been reading too many of Chris Torek's treatises to
comp.lang.c, but storing an integer in storage for pointers is
unportable, a union is needed. it should work just fine on the OP's
system, though.

--
Kjetil T.