Static Functions and Variables
Static Functions and Variables
- Subject: Static Functions and Variables
- From: Jason Stephenson <email@hidden>
- Date: Sun, 15 Jun 2008 11:36:02 -0400
My question is:
Does it make a difference if I put static functions and variables inside
or outside of my Class' @interface?
I tend to treat them like C functions and variables and place them at
the top of my source (.m) file, before the @interface declaration.
When it comes to static functions, these are generally helpers used to
streamline code in if statements or to manipulate an object in some way.
Generally, I use them for shorthand of repeated steps or occasionally to
assist in the +initialize function.
The static variables, of course, are "Class" member variables more or
less, basically used to manage class wide settings, etc.
I have seen examples where the above appear inside the @interface @end
pair, and I've even moved some of my statics inside the @interface just
to see if it makes any difference, and it does not appear to have any
noticeable effect, other than in code organization.
So, after all the intro., my question is which is the more common way of
using static variables and functions? Do you put them before the
@interface or "inside" it?
Thanks,
Jason
_______________________________________________
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