[Mono-list] Something that compiles in Monodevelop/Mono but not in MSVS - is this a bug?

Collin dcday137 at gmail.com
Thu Jul 7 12:27:17 EDT 2011


Hi all - 

I am using Mono JIT 2.10.2 / Monodevelop 2.4 on my linux box.  I wrote a
small utility for myself at work that compiled in Monodevelop, but not MSVS.
The basic idea was:

	[StructLayout(LayoutKind.Sequential, Pack=1)]
	public unsafe struct MyStruct
        {
            ...fields...
            public uint Table[SomeLength];
            ....fields...
       }

Then later, given stuff is a MyStruct:
                unsafe
                {
                    fixed (uint* pTable= &stuff.Table)
                    {
                        uint* pTable = (uint*)pLut;
                        for (int i = 0; i < SomeLength; i++)
                        {
                            if (i % 8 == 0)
                                w.Write("    ");
                            w.Write("0x{0:X8}, ", pTable[i]);
                            if ((i + 1) % 8 == 0)
                                w.WriteLine();
                        }
                    }
                }

I didn't notice this, but the line:
fixed (uint* pTable= &stuff.Table) should be fixed (uint* pTable=
stuff.Table) since Table is actually an array.  I caught this when I tried
to compile in MSVS.  So their is a discrepancy.  Could this be a problem?

Thanks!

--
View this message in context: http://mono.1490590.n4.nabble.com/Something-that-compiles-in-Monodevelop-Mono-but-not-in-MSVS-is-this-a-bug-tp3651987p3651987.html
Sent from the Mono - General mailing list archive at Nabble.com.


More information about the Mono-list mailing list