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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T06:31:23+00:00 2026-05-20T06:31:23+00:00

If a local object is returned in a function call, it has to do

  • 0

If a local object is returned in a function call, it has to do at least three steps:

  1. Copy constructor is called to hold a copy.
  2. Destroy local object.
  3. A copy is return.

For example:

x = y + z

If x is an integer object. A copy of y + z should be returned, then a new object is created, then assignment operator of x will take this object as parameter.

So my questions are:

  • Is the same process used for built-in type such as int, double…?
  • If they’re not the same, how’s it done?
  • 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-20T06:31:23+00:00Added an answer on May 20, 2026 at 6:31 am

    The language specification does not say “how it is done” for built-in types and built-in operators. The language simply says that the result of binary + for built-in types is an rvalue – the sum of the operand values. That’s it. There’s no step-by-step description of what happens when a built-in operator is used (with some exceptions like &&, , etc.).

    The reason you can come up with a step-by-step description of how an overloaded operator works (which is what you have in your question) is because the process of evaluating overloaded operator comes through several sequence points. A sequence point in a C++ program implements the concept of discrete time: it is the only thing that separates something that happens before from things that happen after. Without a separating sequence point, there’s no “before” and no “after”.

    In case of an overloaded operator, there quite a few sequence points involved in the process of its evaluation, which is why you can describe this process as a sequence of steps. The process of evaluation of built-in operator + has no sequence points in it, so there absolutely no way to describe what happens there in step-by-step fashion. From the language point of view, the built-in + is evaluated through a blurry indivisible mix of unspecified actions that produce the correct result.

    It is done this way to give the compiler better optimization opportunities when evaluating built-in operators.

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

Sidebar

Related Questions

I have a data object (let's say it's called 'Entry') that has a set
Are local object variables the variables that are used or initialized in a method,
I'm using a local shared object as means to transfer data between two swf's
I'm trying to save a CUploadedFile object in local folder, I am using img
How can I shift timezone of Date object created in local timezone to target
I was playing with the DateTime object in PHP 5.3 on my local machine
I have three tables: Project: ... relations: User: local: authorId foreign: id Users: class:
I'm trying to pass local variables to an inline function in javascript and have
I'm able to consume a local WSDL into PHP, and pass/return basic data successfully,
Consider the code bellow. // Consider that MyObject receives three integers in it's constructor.

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.