I spoke with a colleague about this yesterday, and it made me think .Net to follow the link.
class Foo {}
static void Test(ref Foo foo) { ... };
static void Main()
{
Foo f;
Test(ref foo);
}
It should be implemented with double indirection, because we change the value of the pointer. Since all reference types are links (pointers)
static void Test(Foo foo) { ... }
static void Test(ref Foo foo) { ... };
mean something like
void Test(Foo *foo);
void Test(Foo **foo);
But if it's a VALUE type , we don’t need double indirection. Therefore, I wonder if
static void Test(ref int bar) { ... }
becomes
void Test(int *bar);
void Test(int **bar);
1/29/10 :
, , , , , ++ , . , CLR JIT . , , , , , , .