Re: bug in glib?



-> doesn't this mean that the list pointer gets "destroyed" when using the
-> function, something that can lead to bugs if you don't know the behavior
-> (the docs don't say anything).

	Variables passed to a function in C are local copies.  Try the
following program for an example (compile with "gcc -lglib local.c")...

--Derek Simkowiak

----------------------------Begin example ----------------------------------
#include <glib.h>


gint my_function(gint foo) {

	foo = foo + 1;
	g_print("Inside my_function(), foo is %d\n", foo);

	return 0;
}


int main(void) {

	gint bar = 5;

	my_function(bar);
	g_print("After my_function(), bar is still %d\n", bar);

	return 0;
}





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