Christian Werner <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] wrote:
>
> > ...
> > The warnings all have to do with the fact that you are
> > compiling on a machine with 64-bit pointers and 32-bit
> > integers. The warnings are all harmless and the code
> > works as intended as long as
> >
> > sizeof(int) <= sizeof(void*)
> >
> > Perhaps a reader can suggest ways of eliminating these
> > warnings.
>
> What about using the ptrdiff_t type in those places instead.
>
Is ptrdiff_t implemented on all C compiler environments that
SQLite builds on?
Also, will it really eliminate the warnings. In several places
we are storing a (32-bit) integer in a pointer.
p = (char*)i;
And then later we get the integer back out:
i = (int)p;
If we change to ptrdiff_t, then we have:
p = (char*)(ptrdiff_t)i; /* Convoluted, but works */
i = (int)(ptrdiff_t)p; /* Still get a warning? */
In the conversion from pointer back to integer, don't we still
get a warning about casting a 64-bit integer into a 32-bit
integer? (I don't know because I do not have a 64-bit machine
easily at hand to test it on.)
--
D. Richard Hipp <[EMAIL PROTECTED]>
-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------