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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T02:10:23+00:00 2026-05-24T02:10:23+00:00

Note: I am using the g++ compiler (which is I hear is pretty good

  • 0

Note: I am using the g++ compiler (which is I hear is pretty good and supposed to be pretty close to the standard).

Not trying to start a grammar war, but just a random question… What is the ideal way to declare a pointer?

int* pI = 4;
int *pI = 4;

(or my favorite, I know it’s non-pretty, but I like it):

int*pI = 4;

Same question stands for references:

int& rI = 4;
int &rI = 4;

or

int&rI = 4;

Maybe there is no right answer. Similarly, should I care whether a constant integer is declared as:

const int I = 4;

or

int const I = 4;

I’m fine with not caring…

I do like the way a const function is declared by having a const after the last parenthesis.

And I believe a constant function has a distinct function signature than the similar non-const function (i.e. the const-nesss is part of the function signature, unlike most sources that say it just depends on the arguments type and the return type).

Is this right? Should I care?

  • 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-24T02:10:24+00:00Added an answer on May 24, 2026 at 2:10 am

    I prefer

    int* a;
    int& b;
    

    for the following reason: the type is int* and not int. For me – the type belongs together and needs to stand separate from the name. I know this introduces some problems with

    int* a, b;
    

    but that’s why I don’t declare to variables in one line.

    Other than that – like VJo said: stick to the coding standard. If everyone around you does it one way, don’t do it the other.

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

Sidebar

Related Questions

Note: I am using the g++ compiler (which is I hear is pretty good
Note: I am using the g++ compiler (which is I hear is pretty good
Note: I am using the g++ compiler (which is I hear is pretty good
( Note : I'm using Scala 2.7.7 here, not 2.8). I'm doing something pretty
Note: Using MySQL 4.0, which means no subqueries (at present). I have 2 tables:
I'm using the Borland (AKA Embarcodegearland) C++Builder 2007 compiler which has a minor bug
NOTE: Using .NET 2.0, and VS2005 as IDE Hello all, I'm working on logging
Note: Using raw Win32 CreateTheard() API No MFC An interface is simply a pointer
Note: Using Monotouch. I have a directory called Images where I have all my
I found the following claim in the documentation for Net::OpenSSH : Note that using

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.