• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: ObjC question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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




From: "Hank Heijink (Mailinglists)" <email@hidden>
Date: Mon, 21 Feb 2011 15:58:47 -0500
To: Tony Romano <email@hidden>
Cc: XCode Apple <email@hidden>
Subject: Re: ObjC question

On Feb 21, 2011, at 3:19 PM, Tony Romano wrote:

<snip>

-(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

  • Follow-Ups:
    • Re: ObjC question
      • From: Quincey Morris <email@hidden>
    • Re: ObjC question
      • From: "Hank Heijink (Mailinglists)" <email@hidden>
References: 
 >Re: ObjC question (From: "Hank Heijink (Mailinglists)" <email@hidden>)

  • Prev by Date: Re: ObjC question
  • Next by Date: Re: ObjC question
  • Previous by thread: Re: ObjC question
  • Next by thread: Re: ObjC question
  • Index(es):
    • Date
    • Thread