GPtrArray has no insert?

View: New views
3 Messages — Rating Filter:   Alert me  

GPtrArray has no insert?

by Martin Kalbfuß :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I make a library to handle group of bitmaps for the allegro lib. The
allegro bitmap type is a pointer type.

So a GPtrArray would be the right choice. But I can't see any insertion
function like the GArray has. Is such a function not present or is it
simply not documented?

And what happens when I try to access a non existent element with an out
of range index? The documentation says nothing about this?

Thanks,
Martin

_______________________________________________
gtk-list mailing list
gtk-list@...
http://mail.gnome.org/mailman/listinfo/gtk-list

Parent Message unknown Re: GPtrArray has no insert?

by Martin Kalbfuß :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

No one knows?

Especially the behavior on an out of range index would be interesting. I
would like to know if I have to implement a check myself.

Thanks

_______________________________________________
gtk-list mailing list
gtk-list@...
http://mail.gnome.org/mailman/listinfo/gtk-list

Re: GPtrArray has no insert?

by Nicola Fontana-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Il giorno Mon, 09 Nov 2009 18:10:49 +0100
Martin Kalbfuß <ma.kalbfuss@...> ha scritto:

> So a GPtrArray would be the right choice. But I can't see any
> insertion function like the GArray has. Is such a function not
> present or is it simply not documented?
>
> And what happens when I try to access a non existent element with an
> out of range index? The documentation says nothing about this?

Hi,

there is no g_array_insert_val() equivalent for GPtrArray, you must
implement it by yourself. If you just want to write data, access directy
the pdata field or use g_ptr_array_index().

If you access out of bounds items you get the same results you encounter
with any array: plain garbage if you are reading and a segmentation
fault if you are writing (and lucky).

Ciao.
--
Nicola
_______________________________________________
gtk-list mailing list
gtk-list@...
http://mail.gnome.org/mailman/listinfo/gtk-list