• 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: Mixing Obj-C and C "methods"
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Mixing Obj-C and C "methods"


  • Subject: Re: Mixing Obj-C and C "methods"
  • From: Jean-Daniel Dupas <email@hidden>
  • Date: Tue, 30 Jul 2013 17:49:50 +0200

Le 30 juil. 2013 à 17:25, Scott Ribe <email@hidden> a écrit :

> On Jul 30, 2013, at 9:08 AM, Andy Lee <email@hidden> wrote:
>
>> I think it's subject to the same criticisms as *any* direct access to ivars, although I agree it feels sketchier when done in plain C for some reason.
>
> Yes. Because what is the point of plain C functions in Objective-C files? Local helpers that are not OOP, and do not go through method dispatch overhead. To turn around and inject direct access to ivars in those is really mixing metaphors.
>
>> Which reminds me... instance methods can also directly access the ivars of *other* instances of the same class.
>
> Now, *that* I knew. I'm sorry senator, I cannot recall if I ever did such a thing. But I knew it was possible ;-)

I think I don't have a single copyWithZone: implementation that does not use this feature.

Foo *copy = [super copyWithZone:];
copy->_myivar = _myivar;

Especially as all ivars are not exposed as properties.


-- Jean-Daniel





_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


References: 
 >Mixing Obj-C and C "methods" (From: Vincent Habchi <email@hidden>)
 >Re: Mixing Obj-C and C "methods" (From: Rick Mann <email@hidden>)
 >Re: Mixing Obj-C and C "methods" (From: Andy Lee <email@hidden>)
 >Re: Mixing Obj-C and C "methods" (From: Scott Ribe <email@hidden>)
 >Re: Mixing Obj-C and C "methods" (From: Andy Lee <email@hidden>)
 >Re: Mixing Obj-C and C "methods" (From: Scott Ribe <email@hidden>)

  • Prev by Date: Re: Mixing Obj-C and C "methods"
  • Next by Date: Re: Mixing Obj-C and C "methods"
  • Previous by thread: Re: Mixing Obj-C and C "methods"
  • Next by thread: Re: Mixing Obj-C and C "methods"
  • Index(es):
    • Date
    • Thread