Re: Some new GString functions - constructors



On Wed, Dec 21, 2005 at 12:33:23AM +0100, Emmanuele Bassi wrote:
> EIther way, you would have another type out: GStringList would be a
> G(S)List of GString; you would have to use:
> 
>   GSList *iter; /* or GList *iter; */
>   for (iter = stringlist; iter != NULL; iter = iter->next)
>     do_something ((GString *) iter->data);
> 
> to iterate though the list, which would break the least-surprise
> principle, since you would have to use a G(S)List pointer to iterate
> through a GStringList.

Yes; PLS is broken there.

As mentioned in the other thread; I'll summarise here. I could return:

  GPtrArray*
  GString**  // NULL-terminated
  GArray*    // of raw GString structs, rather than GString* pointers.

This last one has interesting ramifications.. See other thread for
detail.

-- 
Paul "LeoNerd" Evans

leonerd leonerd org uk
ICQ# 4135350       |  Registered Linux# 179460
http://www.leonerd.org.uk/

Attachment: signature.asc
Description: Digital signature



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