On Tue, Apr 14, 2009 at 7:50 PM, Michael Jennings <e-de...@kainx.org> wrote:
> 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.

lol... the *warning* is the good thing about not initializing
variables: you know when you miss it. As I said, if it was useful to
init things to 0, then gcc would do it already, don't you think?


> 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.

ok, I'm getting out of this thread. Keep believing in your computer
science 101 myths and be happy.

-- 
Gustavo Sverzut Barbieri
http://profusion.mobi embedded systems
--------------------------------------
MSN: barbi...@gmail.com
Skype: gsbarbieri
Mobile: +55 (19) 9225-2202

------------------------------------------------------------------------------
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

Reply via email to