_iVar prefixes (was Re: Draggable buttons)
_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