• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Bug in g++'s int constructor?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Prev by Date: WO Java Client Menu
  • Next by Date: NSString Unicode canonical decompositions?
  • Previous by thread: Re: Bug in g++'s int constructor?
  • Next by thread: Re: Bug in g++'s int constructor?
  • Index(es):
    • Date
    • Thread