You should quote the object of the comment ENTIRELY before commenting, shouldn't you? The actual comment by PenT does state as much:
"to assign NULL to it after g_slist_free ()..."

AFTER g_slist_free. I don't see that I was mutually exclusive in my reply.

On May 14, 2009 11:51am, Chris Moller <mol...@mollerware.com> wrote:
american.communist.pa...@gmail.com wrote:

> Its old hat to C programmers that you set any object to NULL when

> you're done with it, which returns the memory used to the heap.



That's specifically /not/ true in C: You have to explicitly free

allocated space--setting a pointer to null doesn't automatically do the

freeing and, in fact, can simply lose the pointer making it impossible

to subsequently free the space. Sometimes it's useful to set the

pointer to null /after/ you free the space just as a flag to yourself

that you've freed it.



> That's not necessary with languages that have garbage collection like

> Java, Python, etc.

>

> On May 13, 2009 3:56am, PenT pen...@gmail.com> wrote:

> > Thanks to Yeti, tml and Pfeiffer, I finally realized what happend to

> the GSList.

> >

> > May be I'm spoiled by Python, Java that I had the strange

> SHOULD-BE-NULL thought, now I know if I need to reuse the GSList*

> variable, the first thing is to assign NULL to it after g_slist_free

> (), also surprised g_slist_length() didn't gave a segmentation fault

> to me, aha.

> >

> ------------------------------------------------------------------------

>

> _______________________________________________

> gtk-list mailing list

> gtk-list@gnome.org

> http://mail.gnome.org/mailman/listinfo/gtk-list

>



















** **

_______________________________________________

gtk-list mailing list

gtk-list@gnome.org

http://mail.gnome.org/mailman/listinfo/gtk-list

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

Reply via email to