Re: State of instance variables defined at instantiation?
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.