Re: [gtk-list] RE: gpointer values
- From: Tomi Ollila <Tomi Ollila tfi net>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] RE: gpointer values
- Date: Thu, 7 Oct 1999 09:40:47 +0300 (EET DST)
Wednesday Oct 6 16:45:59 +0200 1999 Arjan J. Molenaar <arjan@xirion.nl> wrote:
> > Is it safe (or portable) to use GINT_TO_POINTER and
> > GPOINTER_TO_INT with short values? Compiler
> > is warning me "cast to pointer from integer of different
> > size."
>
> No problem AFAIK. pointers are at least 32 bits (on modern systems, I don't think you want to run it on a XT), a short is 16 bits.
>
> regards,
>
> Arjan
If you are going to convert 32 bit pointer to 16 bit short value you're
going to lose some information and cannot convert it back to any usable
pointer value. You sure can use the value for some purpose, for example
a hash key.
If you want to do pointer manipulation w/ integer values, use type `gint'
(or guint?) for the integer variable.
gtk sources seems to have lots of examples where to use GPOINTER_TO_INT
and GINT_TO_POINTER conversions. I have used these once in
http://iki.fi/too/sw/releases/zip08x-0.9.4.tar.gz so I think I know
what I am writing here ;)
>
> --
> To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null
>
Tomi
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]