• 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: State of instance variables defined at instantiation?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: State of instance variables defined at instantiation?


  • Subject: Re: State of instance variables defined at instantiation?
  • From: Piers Uso Walter <email@hidden>
  • Date: Mon, 26 May 2003 13:55:39 -0400

On Monday, May 26, 2003, at 13:34 America/New_York, Greg Hurrell wrote:

I've checked my Cocoa book, the list archives etc, and I want to know: Is the state of instance variables inside an object defined at instantiation time?

Testing shows that pointers to objective-c objects are nil, and ints are 0 etc.

But I want to know if I can always depend on this... ie. is it defined behaviour?

It is defined behavior and you can depend on it. Here is what Apple's book "The Objective-C Programming Language" states in its section "Creating Instances":

The alloc method dynamically allocates memory for the new object's instance variables and initializes them all to 0 - all, that is, except the isa variable that connects the new instance to its class.


With kind regards

Piers

--
Piers Uso Walter <email@hidden>
ilink Kommunikationssysteme GmbH
_______________________________________________
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.

References: 
 >State of instance variables defined at instantiation? (From: Greg Hurrell <email@hidden>)

  • Prev by Date: State of instance variables defined at instantiation?
  • Next by Date: Re: Tooltip Question
  • Previous by thread: State of instance variables defined at instantiation?
  • Next by thread: Re: State of instance variables defined at instantiation?
  • Index(es):
    • Date
    • Thread