Skip navigation.
 
mlRe: pointers in objective-c?
FROM : Clark S. Cox III
DATE : Fri Aug 01 20:54:06 2008

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_removed>> 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 (<email_removed>)
>
> 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/<email_removed>
>
> This email sent to <email_removed>

Related mailsAuthorDate
mlpointers in objective-c? Wayne Shao Aug 1, 20:43
mlRe: pointers in objective-c? Ken Thomases Aug 1, 20:47
mlRe: pointers in objective-c? Clark S. Cox III Aug 1, 20:54
mlRe: pointers in objective-c? Glenn English Aug 1, 21:10
mlRe: pointers in objective-c? Jens Alfke Aug 1, 21:18
mlRe: pointers in objective-c? Clark S. Cox III Aug 1, 21:24
mlRe: pointers in objective-c? Arthur Coleman Aug 1, 21:38
mlRe: pointers in objective-c? Clark Cox Aug 1, 22:01
mlRe: pointers in objective-c? Giulio Cesare Sola… Aug 1, 22:07
mlRe: pointers in objective-c? Clark S. Cox III Aug 1, 22:15
mlRe: pointers in objective-c? Glenn English Aug 1, 22:20
mlRe: pointers in objective-c? Michael Ash Aug 1, 22:47
mlRe: pointers in objective-c? Sherm Pendley Aug 1, 23:07
mlRe: pointers in objective-c? Daniel Staal Aug 2, 00:27
mlRe: pointers in objective-c? Negm-Awad Amin Aug 2, 09:05
mlRe: pointers in objective-c? Negm-Awad Amin Aug 2, 09:09
mlRe: pointers in objective-c? mm w Aug 2, 18:50
mlRe: pointers in objective-c? mm w Aug 2, 20:19
mlRe: pointers in objective-c? Keary Suska Aug 2, 22:53
mlRe: pointers in objective-c? Negm-Awad Amin Aug 4, 08:31