Re: GPtrArray has no insert?



Il giorno Mon, 09 Nov 2009 18:10:49 +0100
Martin Kalbfuß <ma kalbfuss web de> 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


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