When declaring a parameter as a pointer to a value type

don't specify a __nogc pointer as the default (__gc) allows you to cover more scenarios...

#using <mscorlib.dll>

using namespace System ;

__value class TheValueType { int i ; } ;

__gc class TheReferenceType { public: TheValueType vt ; } ;

void f( TheValueType /* __gc */ * pvt ) // __gc is implicit as this is a managed type

{

}

void wmain()

{

TheValueType vt ;

f( & vt ) ; // Bits on stack

TheValueType __nogc * pvt = __nogc new TheValueType ;

f( pvt ) ; // Bits on native heap

TheValueType * pvtbis = __nogc new TheValueType ;

f( pvtbis ) ; // Bits on native heap but __gc pointer (GC will ignore it)

TheReferenceType * prt = new TheReferenceType ;

f( & prt->vt ) ; // Bits on managed heap (interior pointer)

}