I have encountered what I presume is a common newcomer's problem, but I haven't 
had any luck with google (maybe I'm using the wrong search terms?). Suppose I 
have a const id, e.g. "const id<FrameProtocol> frame". If I attempt to call a 
getter for the object I get the following compiler error:
request for member 'frameNumber' in 'frame', which is of non-class type 
'objc_object* const'

Is there any way of declaring the getter (which in this case is just the 
auto-synthesized one...) as const (or otherwise express the fact that it can be 
safely called on a const object)? I assume that the auto-synthesized one *is* 
const - certainly there's no reason for it not to be that I can think of. 

The reason I am in fact encountering this is when I attempt to access 
properties from within a block, where the instance is treated as 'const' by 
default.

There are of course ways I can work around all this, I just feel that I am 
missing the 'right' way of doing this. Any comments?

Thanks
Jonny

_______________________________________________

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 arch...@mail-archive.com

Reply via email to