Re: Bug in g++'s int constructor?
Re: Bug in g++'s int constructor?
- Subject: Re: Bug in g++'s int constructor?
- From: Brian Webster <email@hidden>
- Date: Thu, 28 Mar 2002 20:33:27 -0600
On Thursday, March 28, 2002, at 06:38 PM, cocoa-dev-
email@hidden wrote:
Granted just changing int sum; to int sum = 0; fixes the problem, but
doesn't change the fact that this is a bug.
To the point, has anyone else discovered this? Filled a bug report?
Should I?
This is not a bug. Local variables in functions and methods are
not guaranteed to be initialized to any particular values. It's
possible that some compilers might do this, but it is not part
of the C standard. Instance variables in Objective-C objects
are initially zeroed out, I'm not sure about C++. You should
explicity initialize all your variables in any methods/functions
before accessing them.
--
Brian Webster
email@hidden
http://homepage.mac.com/bwebster
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.