On Fri, 2011-10-14 at 08:22 -0700, bsquared wrote:
> Martin Ertsås <mert...@cisco.com> writes:
> >
> > You could use out instead to populate the list:
> >
> > static void populate_list (out Slist<string> list) {
> > }
> >
> > And call this method with:
> >
> > var list = new Slist<string> ();
> > populate_list (out list);
> 
> Thank you.
> 
> I originally tried the 'out' modifier, and I got a warning[1].
> I looked at the tutorial[2] and it seems to indicate the 'ref'
> modifier is used as in your example. It indicates that the 'out' 
> modifier is called like this:
> 
>          SList<string> list;
>          populate_list (out list);
> 
> It would be initialized on the callee side.  
> 
>          static void populate_list (out SList<string> list) {
>                 list = new SList<string> ();
>                 [...]
>          } 
> 
> [1] - use of possibly unassigned parameter.
> [2] - http://live.gnome.org/Vala/Tutorial#Parameter_Directions 

The empty list is NULL not new SList<string> (). new SList<string> () is
a list of length 1 with garbage as contents.

Regards

Attachment: signature.asc
Description: This is a digitally signed message part

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

Reply via email to