[Mono-dev] [Mono-patches] r107198 - trunk/mcs/class/corlib/System

Andreas Nahr ClassDevelopment at A-SoftTech.com
Fri Jul 4 13:50:15 EDT 2008


> >  This is used thousands of times throughout the class libraries.
> > But in *THIS* case with void * it does not seem to work. So this was
> the easiest way to fix the problem.
> 
> Ok, I used a class and int as type. So here a test using an unsafe
> struct and void* as member, just like IntPtr does:
> 
> meebey at redbull:~$ cat test.cs
> using System;
> 
> unsafe class Test
> {
> 	int value;
> 
> 	Test(int value)
> 	{
> 		this.value = value;
> 	}
> 
> 	public static void Main ()
> 	{
> 		Test t = new Test(123);
> 		Console.WriteLine(t.value);
> 
> 		AnotherTest at = new AnotherTest(123);
> 		Console.WriteLine((int) at.value);
> 	}
> }
> 
> public unsafe struct AnotherTest
> {
> 	internal void* value;
> 
> 	public AnotherTest(int value)
> 	{
> 		this.value = (void*) value;
> 	}
> }
> 
> meebey at redbull:~$ mono test.exe
> 123
> 123

Although it is interesting that this seems to work (by the way the problem was that I couldn't even compile it). I still do not see the use of showing a test that shows that there are situations in which it works. If you want to reproduce the problem then I suggest that you take the Version of IntPtr (it’s a small and simple type anyways) before my changes and then change the values accordingly and then you will hopefully see the problem.

Then reduce it to the smallest case possible.
Then you would have to analyze the reason for it.

That (which could easily take one or more days) then leads you to maybe fix a corner-case that probably nobody ever used (well exaggerating a little bit ;) except the IntPtr struct.

> >
> > Greetings Andreas
> >
> > P.S. If you want to make further "tests" maybe mail me private and
> not through the list to keep the noise low.
> 
> I don't think this is noise as you had issues with a possible compiler
> bug, so allow other developers to join the discussion and comment on
> the test-code.

I will not research any further here because imho it's just not worth my time and there are far more important things to fix. Feel free to do if you like.



More information about the Mono-devel-list mailing list