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

  • Home
  • SEARCH
  • 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 1010295
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T09:03:40+00:00 2026-05-16T09:03:40+00:00

In my header, I have a prototype declaration like this: void move(int, int); I

  • 0

In my header, I have a prototype declaration like this:

void move(int, int);

I can omit the parameter names, that’s how I’m used to it from C. I do that so that I don’t have to keep the parameter names in sync – it’s extremely confusing if they differ between prototype and implementation.

Right now, I’m documenting all of my code with Doxygen, and I decided to put all comments into the header. Now I have to refer to parameter names that are defined in the implementation but not in the header: I find that confusing.

/**
 * Moves the entity to the specified point.
 * @param x The x coordinate of the new position.
 * @param y The y coordinate of the new position.
 */
void move(int, int);

In the generated Doxygen HTML, it is not easy to figure out which parameter is which. Of course, one could follow the same order here, but if one has many parameters, it is still confusing.

The alternative would be to duplicate parameter names and try to keep them in sync. However, some people don’t encourage this approach, saying that header parameters should start with a double underscore so that the user of a method can not possibly use the same name (names starting with __ are disallowed in C++).

How do you do it?

  • 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-16T09:03:40+00:00Added an answer on May 16, 2026 at 9:03 am

    Surely if "names starting with __ are disallowed in C++", you shouldn’t be using them in prototypes either 🙂 *a

    I see two ways to do it.

    One, you can ensure that the order of parameters in your comments always matches the order in your prototype.

    Or, two, you could actually put the real names in your prototypes as well.

    Myself, I prefer the second approach since I like to be able to tell what parameters are passed in, even if the function has no comments on it (or worse, the comments get out of date). This is far easier with a prototype like:

    void move(int xcoord, int ycoord);
    

    than it is with:

    void move(int, int);
    

    In some environments, we’ve even gone so far as to have the build process ensure that all function prototypes have identically named parameters as the function definition.


    *a) These identifiers are actually not for the use of regular programs. Section 17.6.3.3.2 of cpp0x (but this restriction has been around for quite a while in both C and C++) states:

    Certain sets of names and function signatures are always reserved to the implementation:

    • Each name that contains a double underscore __ or begins with an underscore followed by an uppercase letter is reserved to the implementation for any use.
    • Each name that begins with an underscore is reserved to the implementation for use as a name in the global namespace.

    In other words, don’t use them for your own purposes.

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

Sidebar

Related Questions

I have C function prototypes (certain windows api header files) that look like: int
I have a template class that looks something like this: template<class T> class C
Say I have a User model in JavaScript that looks something like this: var
Consider I have the following function prototype: void MyFunction(int MyParameter); With the following definition:
In my header file, I have this: std::string StringExtend(const std::string Source, const unsigned int
Imagine I have this C function (and the corresponding prototype in a header file)
So I have a site that I have internationalized. On my header I have
I have a header text in a h1 tag. I'd like to have a
I have a class header file called Grid.h that contains the following 2 private
I have a HTML-page, that's encoded in ISO-8859-1 and a Prototype-AJAX call that's build

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.