Re: ObjC question
Re: ObjC question
- Subject: Re: ObjC question
- From: Tony Romano <email@hidden>
- Date: Mon, 21 Feb 2011 13:22:11 -0800
- Thread-topic: ObjC question
I don’t think that will work, that will pass in the address of the local variable, leftNote(sic) and not the one contained in the object. The address being passed in will be on the stack. I need to pass a reference to the one contained in the object node.
Thanks, Tony Romano
On Feb 21, 2011, at 3:19 PM, Tony Romano wrote: -(void) insert: (BTreeNode **) node node:(BTreeNode *) n { …
// get the address of the left member [self insert:&[(*node) left] node:n]; // <--- error }
The compiler(GCC 4.2 or LLVM 1.6) is giving this error : address _expression_ must be an lvalue or a function designator.
The syntax you want is simply this:
BTreeNode *leftNote = [(*node) left]; [self insert:&leftNode node:n]; The return value for [(*node) left] may be an lvalue, but the _expression_ isn't. I don't know of a syntax that will let you get the address you want in one _expression_. However, in the interest of readability, I would prefer the two-line solution regardless.
Best, Hank
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden