On Tuesday, 14 April 2009, at 16:53:44 (-0300), Gustavo Sverzut Barbieri wrote:
> But initializing pointers to NULL or variables to 0 is not good, if > it was be sure that compilers would do that automatically. It's > easier to hide bugs with that, you'll make it harder to valgrind to > help you :-/ I disagree strongly. If it were good to leave variables uninitialized, there would be no such thing as a "use of uninitialized variable" warning. And setting a pointer to NULL does not stop valgrind from helping anything. If it did, valgrind wouldn't be able to find memory leaks, which it does quite well. The fact is, assigning a variable one value and then assigning it another one right away is something that the compiler will optimize out with no trouble at all. So it really doesn't hurt anything to do it. And in most cases, there is no other way of testing for pointer validity apart from !NULL, so initializing your pointers (and resetting them after free()) is very important. Michael -- Michael Jennings (a.k.a. KainX) http://www.kainx.org/ <m...@kainx.org> Linux Server/Cluster Admin, LBL.gov Author, Eterm (www.eterm.org) ----------------------------------------------------------------------- "You can accomplish much if you don't care who gets the credit." -- Ronald Reagan ------------------------------------------------------------------------------ This SF.net email is sponsored by: High Quality Requirements in a Collaborative Environment. Download a free trial of Rational Requirements Composer Now! http://p.sf.net/sfu/www-ibm-com _______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel