[PATCH] Objective-C : Do not accept an object as parameter to a method

Devang Patel dpatel@apple.com
Fri Jun 28 12:22:00 GMT 2002


On Thursday, June 27, 2002, at 03:02 AM, Nicola Pero wrote:

>
> An object is declared as in (NSObject *) [it's really a pointer to the
> actual object] - and unless you do low-level things such as casting it 
> to
> a pointer to an appropriate struct etc which you can always do - you 
> must
> always pass around pointers/references to objects, rather than the 
> objects
> themselves.
>
> His patch looks like preventing something like 'NSObject' to be used as
> the type for a method argument ... which would be the hypothetical 
> syntax
> to pass the object itself (rather than a pointer to the object) as
> argument to a method ... this syntax won't currently work as far as I 
> know
> (but the compiler doesn't reject it) - and I agree with Devang it's 
> not a
> good idea to make it work :-) it's better to raise an error as that 
> might
> catch a common typing mistake (leaving out the '*').

Exactly.

Devang



More information about the Gcc-patches mailing list