|
-
February 13th, 2008, 02:57 AM
#1
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
-
February 14th, 2008, 07:02 PM
#2
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
-
February 15th, 2008, 12:19 AM
#3
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?
 Originally Posted by wildfrog
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|