Re: How to use a gpointer?
- From: Lars Hallberg <lah micropp se>
- To: gtk-list redhat com
- Subject: Re: How to use a gpointer?
- Date: Thu, 4 Mar 1999 16:10:44 +0100
On Thu, Mar 04, 1999 at 01:50:15PM +0300, Alexander Kotelnikov wrote:
> More if you have there are crazy systems (e.g. DOS) were
> sizeof(int a)!=sizeof(int b) if a,b are stored in different memory parts.
Did't know about this ;-)
> * casting scalar type (int) to pointer (gpointer) is not good idea anyway.
True, but glib docs advise You to do it ;-) Glib is suposed to be
cross platform and use translation between gint and gpointer internaly
(se funktion g_int_hash() for example) so I guess it works (possably
by garanteeing that gint is newer biger then gpointer - whatever the
size of a 'plain' int is)...
Having a gparam who is a union of int, void* and maybe something more
vould be nicer but I don't remember if ansi-C allow passing unions as
parameters (used C++ for too long ;-)
PS Is ther a clear document declaring what one can safely do (cast)
with the varius gfoo types? DS
/Lars
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]