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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T02:58:34+00:00 2026-06-13T02:58:34+00:00

Why was C++ designed like this?… (This question is different, but intimately related to

  • 0

Why was C++ designed like this?…

(This question is different, but intimately related to

Not possible: this pointer as a default argument. Why? )

  • 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-13T02:58:35+00:00Added an answer on June 13, 2026 at 2:58 am

    Actually, that’s not completely accurate. The restrictions are:

    8.3.6 Default arguments [dcl.fct.default]

    7) Local variables shall not be used in a default argument. [ Example:

    void f() {
    int i;
    extern void g(int x = i); //error
    // ...
    }
    

    —end example ]

    8) The keyword this shall not be used in a default argument of a member function. [ Example:

    class A {
    void f(A* p = this) { } // error
    };
    

    So, this and local variables can’t be used as defaults.

    For example, the following is valid:

    int a = 1;
    int f(int);
    int g(int x = f(a)); // default argument: f(::a)
    void h() {
      a = 2;
      {
        int a = 3;
        g(); // g(f(::a))
      }
    }
    

    g will be called with the value f(2), which isn’t a compile-time constant. This is an example straight from the standard.

    The reasons it’s like this is the usual: there either wasn’t a proposal for it, or it was rejected, deemed not necessary or too difficult to implement.

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

Sidebar

Related Questions

I just need some confirmation is database designed like this is fine or not.
I would like to have an AppWidget that designed like this one . Image:
I have SQL Server 2008 with a table called ProductCategories designed like this: Id
is this proofed: every algorithm A designed using go to or something like, is
I found some classes designed for debugging in package com.sun.jdi like VirtualMachine , but
I have menu designed using jQuery in oracle apex.The menu is like this Parent1
I have a questing regarding MSMQ... I designed an async arhitecture like this: CLient
I have a dialog box designed like this: <div id=choose_product title=Choose a Product style=display:none;>
I am maintaining an application which has been designed like this: messy code --abuses-->
I have a data structure designed like this: employee . department . building .

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.