[Mono-devel-list] Performance w/ boxing

Jonathan Pryor jonpryor at vt.edu
Fri Feb 20 18:27:17 EST 2004


On Fri, 2004-02-20 at 09:39, Cesar Mello wrote:
> By the way, I did a small DLL in Visual C++.NET, with this code:
>     public __gc class Class1
>     {
>   public:
>     bool f (int __gc *pValue)
>     {
>       ...
> Then made a small test app in Visual C#, referencing the DLL. When 
> typing the method call, intellisense popped up:
> bool Class1.f(ref int pValue)

Quite right.  A `int __gc*' is a managed pointer, which is how you pass
*anything* by-reference: through a pointer.

The problem is that the C# language and compilers prevent you from
making use of that fact.  You cannot pass `null' to a function expecting
a `ref' or `out' variable, as it's contrary to the C# language rules. 
C++ permits it, certainly, but it is not supported by any other managed
language (that I know of).

 - Jon

More information about the Mono-devel-list mailing list