Click here to Skip to main content
15,902,299 members
Home / Discussions / Managed C++/CLI
   

Managed C++/CLI

 
GeneralManaged and Unmanaged structures Pin
-=jarl=-26-Feb-03 6:55
-=jarl=-26-Feb-03 6:55 
GeneralRe: Managed and Unmanaged structures Pin
-=jarl=-26-Feb-03 6:58
-=jarl=-26-Feb-03 6:58 
GeneralRe: Managed and Unmanaged structures Pin
Paul Selormey26-Feb-03 13:51
Paul Selormey26-Feb-03 13:51 
GeneralRe: Managed and Unmanaged structures Pin
-=jarl=-26-Feb-03 23:16
-=jarl=-26-Feb-03 23:16 
GeneralRe: Managed and Unmanaged structures Pin
Paul Selormey27-Feb-03 0:20
Paul Selormey27-Feb-03 0:20 
GeneralRe: Managed and Unmanaged structures Pin
-=jarl=-27-Feb-03 0:22
-=jarl=-27-Feb-03 0:22 
GeneralManaged/Unmanaged: pinning ptr madness Pin
VizOne25-Feb-03 22:04
VizOne25-Feb-03 22:04 
GeneralRe: Managed/Unmanaged: pinning ptr madness Pin
Jeff J26-Feb-03 16:24
Jeff J26-Feb-03 16:24 
VizOne wrote:
How can it be, that &(*this) and &val1 are implicitely are converted to
__nogc pointers that can be castet to void*?


Essentially, __gc pointer and a __nogc pointer are the same thing, just values that hold memory addresses, whether pinned or not. So that you got away without pinning first, is just luck that the GC memory where the pointed-to objects were stored, was not moved during a garbage collection cycle. Pinning mostly just tells the GC not to move any object pointed-to by a pinned pointer.

If the GC moved the objects before the unpinned version of Function1() was called, there would be serious problems. However, there also is no guarantee that the GC would actually move those particular objects during collection; it is simply a possibility.

Incidentally, there are a few implicit things that occur in MC++ that are not well documented. Also, I recall reading somewhere that because of such things, any use of reinterpret_cast is discouraged in MC++. Of course, what would we do without it? MS is likely just covering their "tracks" with such warnings Wink | ;)

Sorry, but I had trouble following your longer explanation, partly because the angle-bracketted portions of the casts were stripped (I sometimes forget to turn off HTML interpretation when I post too - very annoying, isn't it?), I am not too familiar with DirectX, and I could not see the IL for myself. However, I very much appreciate the extended explanation; it's short explanations that I more often have trouble interpreting.

Cheers
GeneralRe: Managed/Unmanaged: pinning ptr madness Pin
VizOne27-Feb-03 1:56
VizOne27-Feb-03 1:56 
GeneralRe: Managed/Unmanaged: pinning ptr madness Pin
VizOne28-Feb-03 0:31
VizOne28-Feb-03 0:31 
GeneralRe: Managed/Unmanaged: pinning ptr madness Pin
Jeff J28-Feb-03 22:25
Jeff J28-Feb-03 22:25 
GeneralImplementing IDisposable Pin
VizOne24-Feb-03 9:49
VizOne24-Feb-03 9:49 
GeneralRe: Implementing IDisposable Pin
Paul Selormey25-Feb-03 0:23
Paul Selormey25-Feb-03 0:23 
GeneralRe: Implementing IDisposable Pin
VizOne25-Feb-03 0:30
VizOne25-Feb-03 0:30 
GeneralRe: Implementing IDisposable Pin
Paul Selormey25-Feb-03 0:49
Paul Selormey25-Feb-03 0:49 
GeneralRe: Implementing IDisposable Pin
VizOne25-Feb-03 0:58
VizOne25-Feb-03 0:58 
GeneralRe: Implementing IDisposable Pin
Paul Selormey25-Feb-03 1:48
Paul Selormey25-Feb-03 1:48 
GeneralRe: Implementing IDisposable Pin
VizOne25-Feb-03 2:45
VizOne25-Feb-03 2:45 
GeneralRe: Implementing IDisposable Pin
Paul Selormey25-Feb-03 2:54
Paul Selormey25-Feb-03 2:54 
QuestionManaged type??? Pin
Orkun GEDiK21-Feb-03 12:49
Orkun GEDiK21-Feb-03 12:49 
AnswerRe: Managed type??? Pin
Paul Selormey23-Feb-03 1:46
Paul Selormey23-Feb-03 1:46 
GeneralRe: Managed type??? Pin
Orkun GEDiK23-Feb-03 3:55
Orkun GEDiK23-Feb-03 3:55 
GeneralRe: Managed type??? Pin
Paul Selormey23-Feb-03 23:49
Paul Selormey23-Feb-03 23:49 
GeneralRe: Managed type??? Pin
Orkun GEDiK24-Feb-03 10:48
Orkun GEDiK24-Feb-03 10:48 
GeneralRe: Managed type??? Pin
Paul Selormey25-Feb-03 0:30
Paul Selormey25-Feb-03 0:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.