Correct, all objective-C objects are allocated on the heap (like using new in C++). The compiler will not allow you to allocate objects on the stack.

There are ways to trick the runtime into treating an area of the stack as of it were an object, but the caviats are a list as long as my arm-- it's just not worth it.

Sent from my iPhone

On Aug 1, 2008, at 11:43, "Wayne Shao" <[EMAIL PROTECTED]> wrote:

It seems that every object is a pointer in the sample code I have
seen.  Is there any distinction between an object and its pointer?

In C++,  C* c; would be an uninitialized pointer. But the following
line will creates an object with the constructor C().

C c;

It seems that there is no such equivalent syntax in Objective-C.
objects are created either from factory pattern or  [[A alloc]
someInitMethod ....];
so, is it possible to write?

NSString a;
NSNumber b;

--Wayne
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/clarkcox3%40gmail.com

This email sent to [EMAIL PROTECTED]
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to