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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T07:32:56+00:00 2026-05-12T07:32:56+00:00

A lot of C++ code uses syntactical conventions for marking up data members. Common

  • 0

A lot of C++ code uses syntactical conventions for marking up data members. Common examples include

  • m_memberName for public members (where public members are used at all)
  • _memberName for private members or all members

Others try to enforce using this->member whenever a data member is used.

In my experience, most larger code bases fail at applying such rules consistently.

In other languages, these conventions are far less widespread. I see it only occasionally in Java or C# code. I think I have never seen it in Ruby or Python code. Thus, there seems to be a trend with more modern languages to not use special markup for data members.

Is this convention still useful today in C++ or is it just an anachronism, especially as it is used so inconsistently across libraries? Haven’t the other languages shown that one can do without member prefixes?

  • 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-12T07:32:56+00:00Added an answer on May 12, 2026 at 7:32 am

    You have to be careful with using a leading underscore. A leading underscore before a capital letter in a word is reserved.
    For example:

    _Foo

    _L

    are all reserved words while

    _foo

    _l

    are not. There are other situations where leading underscores before lowercase letters are not allowed. In my specific case, I found the _L happened to be reserved by Visual C++ 2005 and the clash created some unexpected results.

    I am on the fence about how useful it is to mark up local variables.

    Here is a link about which identifiers are reserved:
    What are the rules about using an underscore in a C++ identifier?

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

Sidebar

Related Questions

I have a lot of C# code that uses public fields, and I would
Over the int type? A lot of code either uses int with double/floats. I
I am tring to port some code, that uses boost::unwrap_reference a lot to C++11.
Related Question: vector <unsigned char> vs string for binary data . My code uses
I've got a lot of older code that uses the old-style pascal object type
In spring, I have a lot of code that uses session beans defined like
I have a lot of existing code which uses raw ADO.NET (DbConnection, DbDataReader, etc).
I have a lot of code that uses C style variable arguments. The code
Our code uses a lot of system properties eg, 'java.io.tmpdir', 'user.home', 'user.name' etc. We
I have a lot of existing code that just uses the normal dateTime class

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.