Returning object by value or smart pointer

Discussion in 'C++' started by mrpringle, Aug 31, 2010.

  1. mrpringle

    mrpringle New Member

    Aug 31, 2010
    Likes Received:
    Trophy Points:
    If I had the following two options, which would be more desirable or generally accepted.

    1. Creating an object on the stack and returning it by value.
    2. Creating an object on the heap, storing it in an auto ptr and returning the auto ptr.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice