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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T11:59:08+00:00 2026-05-20T11:59:08+00:00

Certainly there is no one right way to do this, but I can’t even

  • 0

Certainly there is no one right way to do this, but I can’t even think of any decent naming scheme, that’s why I’m asking here. (So: While all answers will be subjective, they will be useful nevertheless!)

The problem is as follows: For simple aggregate structs, we do not use member var prefixes.

struct Info {
  int x;
  string s;
  size_t z;

  Info()
  : x(-1)
  , s()
  , z(0)
  { }
};

It is nevertheless sometimes useful to provide an initializer ctor to initialize the struct, however – I cannot come up with a decent naming scheme for the parameters when the most natural names for them are already taken up by the member variables themselves:

struct Info {
  int x;
  string s;
  size_t z;

  Info(int x?, string s?, size_t z?)
  : x(x?)
  , s(s?)
  , z(z?)
  { }
};

What are other people using in this situation?

  • 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-20T11:59:08+00:00Added an answer on May 20, 2026 at 11:59 am

    Why invent pre/postfixes? I just use the same name. C++ is designed for that to work.

    struct Info {
      int x;
      string s;
      size_t z;
    
      Info(int x, string s, size_t z)
      : x(x)
      , s(s)
      , z(z)
      { }
    };
    

    It’s straight forward.

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

Sidebar

Related Questions

Certainly there's the difference in general syntax, but what other critical distinctions exist? There
Is there any elegant way of applying a certain style to all <input type=text>
Is there a way I can write text to a file from a certain
This question is related to this older one, but I wanted to be sure
I think this falls under the concept of contextual binding , but the Ninject
There are certain conditions that can cause stack overflows on an x86 Linux system:
Is there a way to restrict certain tables from the mysqldump command? For example,
Is there a way to edit the log message of a certain revision in
Is there a quick way to determine whether you are using certain namespaces in
Is there a way to get XmlSerialization in .NET to ignore certain properties while

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.