J
Joe
I am trying to get a good understanding of these concepts and how they apply
to code and classes (possibly different). As well as MSIL and Native Code
(x86 assembly).
To facilitate discussion consider the following code.
//////////////////////////////////////////////////
// compiled with /clr
ref class A {
//code and members
};
class B{
//code and members
};
#pragma unmanaged
class C{
//code and members
};
//////////////////////////////////////////////
Are the following comments correct?
Class A
1. Class A is a managed type (because it is gc)
2. Class A code is MSIL executed by the CLR
3. Class A is dynamically allocated with gcnew on the CLR heap (thus garbage
collected);
Class B
1. Class B is a native type (because it does not use new language
constructs)
2. Class B is a unmanaged type (because it is not gc)
3. Class B code is MSIL executed by the CLR
4. Class B is dynamically allocated with "new" on the regular C++ heap (not
gc).
Class C
1. Class C is a native type (because it does not use new language
constructs)
2. Class C is a unmanaged type (because it is not gc)
3. Class C code is X86 assembly code ran directly on the processor
4. Class C code is dynamically allocated the "new" on the regular C++ heap
(not gc).
Note the only difference in B and C is the type of code generated.
Note that Class B is unmanaged even though it occurs because the #pragma
unmanaged statement. That's a bit confusing. Do I have that concept correct?
It you have any other permutations of logic that would be helpful, I would
appreciate them.
Thanks Joe
--
to code and classes (possibly different). As well as MSIL and Native Code
(x86 assembly).
To facilitate discussion consider the following code.
//////////////////////////////////////////////////
// compiled with /clr
ref class A {
//code and members
};
class B{
//code and members
};
#pragma unmanaged
class C{
//code and members
};
//////////////////////////////////////////////
Are the following comments correct?
Class A
1. Class A is a managed type (because it is gc)
2. Class A code is MSIL executed by the CLR
3. Class A is dynamically allocated with gcnew on the CLR heap (thus garbage
collected);
Class B
1. Class B is a native type (because it does not use new language
constructs)
2. Class B is a unmanaged type (because it is not gc)
3. Class B code is MSIL executed by the CLR
4. Class B is dynamically allocated with "new" on the regular C++ heap (not
gc).
Class C
1. Class C is a native type (because it does not use new language
constructs)
2. Class C is a unmanaged type (because it is not gc)
3. Class C code is X86 assembly code ran directly on the processor
4. Class C code is dynamically allocated the "new" on the regular C++ heap
(not gc).
Note the only difference in B and C is the type of code generated.
Note that Class B is unmanaged even though it occurs because the #pragma
unmanaged statement. That's a bit confusing. Do I have that concept correct?
It you have any other permutations of logic that would be helpful, I would
appreciate them.
Thanks Joe
--