Re: Multi dim array



On Fri, Oct 12, 2007 at 08:55:54PM +0200, fred238 free fr wrote:
> fred238 free fr a écrit :
> > Paul Davis a écrit :
> >> On Fri, 2007-10-12 at 20:26 +0200, fred238 free fr wrote:
> >>> hello,
> >>>
> >>> Is possible to make static or dynamic multi dim array with glib ?
> >>
> >> this is a basic C programming question. why are you asking about glib?
> 
> Question is about to make multi dim array with glib not with libc, maybe with GArray, GPtrArray, GByteArray or something else, ...

You can make a GArray of GArrays or use a G[foo]Array
with suitable indexing as the storage base for
a multidimensional array.

But why?

Since your original question mentions static arrays, some
misunderstanding is going on here.  Essentially the only
added value of G[foo]Array is that it can automatically grow
on request -- and you pay a high price for that: type safety
(with the exception of GByteArray).  Static GArrays do not
make any sense at all, multidimensional or not, because they
cannot grow.

The wildly varying behaviours people might want from
automatically growing multidimensional arrays is probably
one of the reasons why GLib implements no such thing.

Yeti

--
http://gwyddion.net/



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