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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T15:06:44+00:00 2026-06-18T15:06:44+00:00

From this question , and consequently, from the Standard (ISO C++-03): It is unspecified

  • 0

From this question, and consequently, from the Standard (ISO C++-03):

It is unspecified whether or not a reference requires storage (3.7).

In some answers in that thread, it’s said that references have, internally, the same structure of a pointer, thus, having the same size of it (32/64 bits).

What I’m struggling to grasp is: how would a reference come not to require storage?

Any sample code exemplifying this would be greatly appreciated.

Edit:
From @JohannesSchaub-litb comment, is there anything like, if I’m not using a const &, or if I’m using a const & with default value, it requires allocation? It seems to me, somehow, that there should be no allocations for references at all — except, of course, when there are explicit allocations involved, like:

A& new_reference(*(new A())); // Only A() instance would be allocated,
                              // not the new_reference itself

Is there any case like this?

  • 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-06-18T15:06:45+00:00Added an answer on June 18, 2026 at 3:06 pm

    Take something simple:

    int foo() {
      int  x = 5;
      int& r = x;
      r = 10;
      return x;
    }
    

    The implementation may use a pointer to x behind the scenes to implement that reference, but there’s no reason it has to. It could just as well translate the code to the equivalent form of:

    int foo() {
      int x = 10
      return x;
    }
    

    Then no pointers are needed whatsoever. The compiler can just bake it right into the executable that r is the same as x, without storing and dereferencing a pointer that points at x.

    The point is, whether the reference requires any storage is an implementation detail that you shouldn’t need to care about.

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

Sidebar

Related Questions

From this question System.currentTimeMillis() is not accurate on windows XP? I know that on
From this question & the answers - What is the correct answer for cout
From this question I learned Double.NaN is not equal to itself. I was verifying
My question originates from this question, where one of the comments suggests that a
I'm gleaning from this question [ Facebook Connect Won't Validate that using Facebook Connect
From this question here , I was writing an enum wrapper to have some
Continuing from this question , i am confused whether DISPID_VALUE on IDispatch::Invoke() for script
From this question , I'm now doing error handling one level down. That is,
This question was emerged from this question. The problem is that there is a
from this question , I drilled down the problem to a listbox, that doesn't

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.