Out of scope and a function



Hi! I'm having trouble explaining a code. My application has a top window which contains a GtkList widget. I 've also created a function(fill_list_with_items())
which populates the clist widget.


GList *fill_list_with_items(GtkWidget *list)
{  int i;
  GList *list_items;
  list_items = NULL;
  for(i = 1; i <= 50; i++)
  {
     list_items = g_list_prepend(list_items,
           populate_row(list, i));
  }
  list_items = g_list_reverse(list_items);

  gtk_list_append_items(GTK_LIST(list), list_items);
  return list_items;
}


populate_row() function create GtkListItem for each row and populate with vbox which contains a GtkLabel widget. My question is: in the above code GList *list_items does not exist beyond the function fill_list_with_items(). So how come the compiler
doesn not complain about it of getting out of scope?

Thanks.

_________________________________________________________________
See Fireworks On Live Image Search http://search.live.com/images/results.aspx?q=Fireworks&mkt=en-ca&FORM=SERNEP




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