CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Apr 2009
    Posts
    16

    From pointers and references; which one is more efficient in terms of memory usage?”

    Hello,

    From pointers and references; which one is more efficient in terms of memory usage?

  2. #2
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    10,895

    Re: From pointers and references; which one is more efficient in terms of memory usag

    There's no significant difference, especially once the optimizer gets involved.

  3. #3
    Join Date
    Mar 2007
    Posts
    155

    Re: From pointers and references; which one is more efficient in terms of memory usag

    Technically references are implicit pointers. There should not be differences.

  4. #4
    Join Date
    Apr 2009
    Posts
    16

    Re: From pointers and references; which one is more efficient in terms of memory usag

    thanks but what is difference in terms of memory? Detail please.................?

  5. #5
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    10,895

    Re: From pointers and references; which one is more efficient in terms of memory usag

    How a compiler chooses to implement references is not defined by the standard, as far as I know. Thus there's no way to answer your question.

    For all intents and purposes, you should consider them equivalent in terms of memory usage.

  6. #6
    Join Date
    Apr 1999
    Posts
    27,449

    Re: From pointers and references; which one is more efficient in terms of memory usag

    Quote Originally Posted by itguy310 View Post
    thanks but what is difference in terms of memory? Detail please.................?
    As Lindley pointed out, there is no standard way that references are implemented. If you have the C++ specification, the only thing that is mentioned about references is how they are supposed to behave, not how they're implemented.

    Regards,

    Paul McKenzie

  7. #7
    Join Date
    Apr 2007
    Location
    Mars NASA Station
    Posts
    1,436

    Re: From pointers and references; which one is more efficient in terms of memory usag

    There are no null references.
    Thanks for your help.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured