• 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: static typing (Learning Cocoa Chapter 13)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: static typing (Learning Cocoa Chapter 13)


  • Subject: Re: static typing (Learning Cocoa Chapter 13)
  • From: John Pannell <email@hidden>
  • Date: Fri, 21 Sep 2001 13:36:29 -0600

Just to add an extra tidbit... the asterisk can appear _appended_ to the type, or _prepended_ to the variable. For example:

NSButton* myButton //right
NSButton *myButton //also right

I think experienced programmers develop a preference based on their mental model of how pointers work. Not being an experienced programmer, I can't say for sure :-)

John P.

On Friday, September 21, 2001, at 12:19 PM, Michael Grant wrote:

At 11:03 -0700 9/21/2001, Henri Lamiraux wrote:
You need the asterisk. The fact that it is an outlet or not has nothing to do with the fact that in Objective-C you cannot statically allocate objects

NSButton myButton // wrong
NSButton* myButton // right

Yes, outlets are pointer but you need to declare a pointer in your header (NSButton myButton is not defining a pointer to a button, NSButton* myButton is)


I gotcha. It's not "dummyView" but "NSBox" that takes the asterisk, then. Thanks!



Look at the examples in the /Developer/Examples/InterfaceBuilder and /Developer/Examples/Cocoa

On Friday, September 21, 2001, at 10:55 AM, Michael Grant wrote:

At 10:18 -0700 9/21/2001, Henri Lamiraux wrote:
Try dummyView*

Either that's not it or I'm not understanding you properly. I shouldn't need the asterisk since the outlet (object) variables are already pointers, right? I tried just adding an asterisk anyway, and it didn't help.

A possible hint as to the nature of the problem: the compiler error messages are "in file included from ToDoAppDelegate.m:2:". This wouldn't have something to do with the way the various files import each other, would it? The #import directive is supposed to prevent that sort of problem, right? I'm afraid I don't know enough about the compiler yet....

Thanks!
Michael


Henri Lamiraux
Engineering Manager
User Interface Tools Group
Apple

-- Now with LRF support and LBL technology!
_______________________________________________
cocoa-dev mailing list
email@hidden
http://www.lists.apple.com/mailman/listinfo/cocoa-dev


  • Follow-Ups:
    • Re: static typing (Learning Cocoa Chapter 13)
      • From: "Erik M. Buck" <email@hidden>
References: 
 >Re: static typing (Learning Cocoa Chapter 13) (From: Michael Grant <email@hidden>)

  • Prev by Date: controlling windows
  • Next by Date: Re: retaining arrays
  • Previous by thread: Re: static typing (Learning Cocoa Chapter 13)
  • Next by thread: Re: static typing (Learning Cocoa Chapter 13)
  • Index(es):
    • Date
    • Thread