• 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
_iVar prefixes (was Re: Draggable buttons)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

_iVar prefixes (was Re: Draggable buttons)


  • Subject: _iVar prefixes (was Re: Draggable buttons)
  • From: Jim Correia <email@hidden>
  • Date: Sat, 2 Feb 2002 13:24:20 -0500

Eric:

2 questions:

At 12:02 PM -0600 2/2/02, Erik M. Buck wrote:

Also, try _myMouseDownEvent or use some other prefix because Apple reserves
the name space for all variables that start with _ and do not have a prefix.
In this particular case, I believe that NSControl already has an instance
variable named _mouseDownEvent.

1: Where is this written down?

2: What happens if there is a collision?

I inherit from some AppKit object and declare _foo.

Scenario 1:

That object already has it declared, so the compiler complains. I fix my code, and everyone is happy.

Scenario 2:

That object doesn't declare _foo. Later I run my compiled app against a new version of AppKit which does declare _foo. Aren't we screwed anyway because the base object changed size breaking binary compatibility? (I am not on my X machine at the moment so I can't disassemble the code to see what happens, but it would make sense to me that iVar accesses generate code equivalent to structure field accesses.)

Scenario 2b:

Some object used to have a var _bar, which they renamed _foo. Should matter if the size stays the same, right?

Jim


  • Follow-Ups:
    • Re: _iVar prefixes (was Re: Draggable buttons)
      • From: "Erik M. Buck" <email@hidden>
References: 
 >Draggable buttons (From: Ben Chess <email@hidden>)
 >Re: Draggable buttons (From: "Erik M. Buck" <email@hidden>)

  • Prev by Date: Re: Draggable buttons
  • Next by Date: Re: Overiding NSButton initWithFrame: (doesn't work)
  • Previous by thread: Re: Draggable buttons
  • Next by thread: Re: _iVar prefixes (was Re: Draggable buttons)
  • Index(es):
    • Date
    • Thread