CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: pointer_default

  1. #1
    George2 is offline Elite Member Power Poster
    Join Date
    Oct 2002
    Posts
    4,468

    pointer_default

    Hello everyone,


    Could anyone show me the usage of pointer_default please (sample of when we need to use ref, unique and ptr)? After some search, I found too little materials on this topic. :-)


    thanks in advance,
    George

  2. #2
    Join Date
    Apr 2005
    Location
    Norway
    Posts
    3,934

    Re: pointer_default

    The usage of pointer_default is to specify which one of ptr, ref or unique that should be used by default (exept for parameters pointers which default to ref).

    For an example check out Default Pointer Types.

    - petter

  3. #3
    George2 is offline Elite Member Power Poster
    Join Date
    Oct 2002
    Posts
    4,468

    Re: pointer_default

    Thanks petter,


    I have some further issue for unique attribute after some study for the link you recommended.

    http://msdn2.microsoft.com/en-us/lib...94(VS.85).aspx

    (Especially confused about "before the call")

    --------------------
    Can use existing memory on the client without allocating new memory. When a unique pointer changes during a call from one non-NULL value to another, the pointer is assumed to point to a data object of the same type. Data returned from the server is written into existing storage specified by the value of the unique pointer before the call.
    --------------------

    I do not know why "Data returned from the server is written into existing storage specified by the value of the unique pointer before the call", especially "the value of the unique pointer before the call".

    Suppose the following scenario,

    1. client pass point ptr1 to server and ptr2 originally pointed to memory buffer1;
    2. server change ptr1 to pointed to memory buffer2, which is different from buffer1;
    3. server writes data through pointer ptr1, it should be written to buffer2.

    So, it should be,

    Data returned from the server is written into existing storage specified by the "lastest" value of the unique pointer, which is memory buffer 2.

    Other than,

    Data returned from the server is written into existing storage specified by the value of the unique pointer "before" the call, which is memory buffer 1.

    Any comments?

    Quote Originally Posted by wildfrog
    The usage of pointer_default is to specify which one of ptr, ref or unique that should be used by default (exept for parameters pointers which default to ref).

    For an example check out Default Pointer Types.

    - petter

    regards,
    George

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