• 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 Functions and Variables
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Static Functions and Variables


  • Subject: Re: Static Functions and Variables
  • From: Jean-Daniel Dupas <email@hidden>
  • Date: Sun, 15 Jun 2008 20:01:16 +0200


Le 15 juin 08 à 17:38, Jason Stephenson a écrit :

Whoops! Had a brain fart.

In my previous message where I say @interface, I meant to say @implemenation. Sorry for any confusion.

Got too much going on today. I should have just stayed away from email.

--Jason

In Obj-C, the concept of static functions/variables does not exists, i.e. it's purely a C concept, you can put it wherever you want, it make no difference.


OK, there is in fact a little difference. If you put a static function into an implementation block, it's possible to access ivars directy even if they are declared private.


@interface Foo : NSObject { @private NSString *ivar; } @end

@implementation Foo

static void MyFunction(Foo *aFoo) {
  NSLog(@"%@", aFoo->ivar);
}

@end

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

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: 
 >Static Functions and Variables (From: Jason Stephenson <email@hidden>)
 >Re: Static Functions and Variables (From: Jason Stephenson <email@hidden>)

  • Prev by Date: Automatically Call a Function
  • Next by Date: Re: Could kEventAppSystemUIModeChanged arrive too early to my handler
  • Previous by thread: Re: Static Functions and Variables
  • Next by thread: Could kEventAppSystemUIModeChanged arrive too early to my handler
  • Index(es):
    • Date
    • Thread