Re: sizeof gpointer



On Tue, 20 Aug 2002, vladimir wrote:

How can i get size of data in bytes ?

if I do sizeof ("text") i will get 5
if I do sizeof (255) i will get 4
if I do sizeof (12345678.987654321) i will get 8...

You can't.

But if i do sizeof (data) i get crazy numbers :( (data is a gpointer)

No, they make perfect sense.

I can not continue work on my prog without this problem solved :(

Please realize that this is not a GTK+ or Gnome problem.

The problem lies with your understanding of C, which is .... lacking ;)

I can recommend:

http://www.amazon.com/exec/obidos/ASIN/0131103628/qid=1029836623/sr=2-1/ref=sr_2_1/002-7884075-0081601
The C Programming Language
Brian Kernighan and Dennis Ritchie.

-Peter

PS: The workaround you are looking for /right now/ is to calculate the
size manually when you create the data and to pass it around together with
the pointer to the data.  When you only have one parameter you can pass
into functions/signal handlers, you use a pointer to a struct that
contains a size field and a pointer to the data.  But /please/ read up on
C before posting to a GTK+ list again -- or use an easier language to
write your program in, say Python.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]