Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1014701
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T10:17:20+00:00 2026-05-16T10:17:20+00:00

This is a style question: Because Apple reserves the _ privatization for its keywords,

  • 0

This is a style question:

Because Apple reserves the “_” privatization for its keywords, I was thinking of something along the lines of the following:

#import <Cocoa/Cocoa.h>

#define _(name) pvt_##name

@interface SFMeasureViewController : NSViewController {
    @private
    NSTextField *_(label);

}

@property (retain) IBOutlet NSTextField *label;

@end


@implementation SFMeasureViewController

@synthesize label = _(label);

@end

This is to help force the difference between [self label] and using label when it comes to retaining, and disposing of the variable properly. Here, using the term “label” within the code returns an error, forcing the user to distinguish between a call to self.label or _(label).

Now _(label) contains 2 more characters (shift-characters at that) than _label does. Is there any other good conventions out there? vLabel? Nothing is as quite as clear as _label but since its reserved, I don’t want to use it.

Thoughts, critiques? This is for a style guideline at work, for primarily C++ work using Objective-C++ when necessary.

Thanks,

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T10:17:21+00:00Added an answer on May 16, 2026 at 10:17 am

    Well, Apple recommends not to use _ as the first letter of anything, especially on method names. But as for instance variables, they themselves go against this principle in their sample codes. So I think _... is perfectly fine for that, without making the macro. I like the property names var vs. the backing instance variable theVar, too. More about this, see the discussion here in SO.

    In the new runtime (i.e. 64 bit on Mac, or iPhone OS, or iPhone simulator starting the ones coming with XCode 4) you don’t even have to declare a backing instance variable explicitly; an ivar is created by the compiler when you @synthesize it, and you can’t access that ivar directly. Thus, if you are OK with supporting only those platforms, that’s the best approach.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This question got me thinking: should we apply the principle that flat is better
This is a question more out of curiosity rather than being stuck. I know
This is a very similar question to AJAX, Subdomains and the 200 OK response
I wanted to know what various guidelines state about the usage of this. Sometimes
I wanted to know what various guidelines state about the usage of this. Sometimes
reviewing the code example on this page, it seem like the example is initializing
I apologize beforehand if none of this makes sense, or if I sound incompetent...
I have a file named insert.txt. It can look like this (or uglier): ASDFG?|??|?\/\HJKL<MNBVCXZQWERTYUIOP
I'm stuck on what I thought was going to be a very simple task
Assume that I have some HTML page, and a corresponding CSS file. I'd like

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.