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 7053199
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:28:33+00:00 2026-05-28T03:28:33+00:00

I used to use prefix underscore for instance variable naming, to distinguish from local

  • 0

I used to use prefix underscore for instance variable naming, to distinguish from local variables.

I happend to see the “Google Objective-C Style Guide”, and found that it suggests to use trailing underscores(refer it HERE), but without any detail explanation about why.

I know it is a coding style issue, but I do wonder is there any advantages of using trailing underscores?

  • 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-28T03:28:34+00:00Added an answer on May 28, 2026 at 3:28 am

    Related: Question about @synthesize (see the blockquotes at the bottom of the answer)
    The advantage is: _var is a convention (C99, Cocoa guidelines) for private, but it is so common (even on Apple templates) that Apple uses double underscore __var. Google solves it by using trailing underscore instead.

    I updated the other answer with a couple more reasons…

    Leading underscore is also discouraged in C++ (see
    What are the rules about using an underscore in a C++ identifier?) and Core Data properties
    (try adding a leading underscore in the model and you’ll get “Name
    must begin with a letter”).

    Trailing underscore seems the sensible choice, but if you like
    something else, collisions are unlikely to happen, and if they do,
    you’ll get a warning from the compiler.

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

Sidebar

Related Questions

We used to use SourceSafe, and one thing I liked about it was that
I used to use the standard mysql_connect(), mysql_query(), etc statements for doing MySQL stuff
I used to use the implicit call of toString when wanting some debug info
I used to use discountasp.net and I can use Visual Studio 2008 to publish
I used to use a guitar tab site and it had a feature where
I used to use procedural-style PHP. Later, I used to create some classes. Later,
I used to use SVN 1.4 on OS X Leopard and everything was fine.
I used to use this script for jquery email obfuscation: $(.replaceAt).replaceWith(@); $(.obfuscate).each(function () {
When I used to use IIS 6 (or so) I'd often make a virtual
Previously, I used to use MFC collection classes such CArray and CMap . After

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.