[Mono-dev] [Mono-patches] r52427 - trunk/mcs/mbas

Rafael Teixeira monoman at gmail.com
Tue Nov 1 08:55:08 EST 2005


Well this is what vbc generates either way:

        .locals init (
                valuetype ExpressionLiteralsNothing/MyStruct    V_0)
        IL_0000:  ldnull
        IL_0001:  dup
        IL_0002:  brtrue.s IL_0014

        IL_0004:  pop
        IL_0005:  ldtoken ExpressionLiteralsNothing/MyStruct
        IL_000a:  call class [mscorlib]System.Type class
[mscorlib]System.Type::GetTypeFromHandle(valuetype
[mscorlib]System.RuntimeTypeHandle)
        IL_000f:  call object class
[mscorlib]System.Activator::CreateInstance(class
[mscorlib]System.Type)
        IL_0014:  unbox ExpressionLiteralsNothing/MyStruct
        IL_0019:  ldobj ExpressionLiteralsNothing/MyStruct
        IL_001e:  stloc.0

So the struct is "synthesized" from a null (very non-c#) either way
(regarding Option Strict). :)

OK?


On 11/1/05, Rafael Teixeira <monoman at gmail.com> wrote:
> Hi Miguel,
>
> The team is already working on it, but there is a test written by
> Ritvik (ExpressionLiteralNothingB.vb) that shows this behaviour is
> consistent with what vbc does.
>
> I've told Maverson just to explore further to make sure if this
> behaviour is affected by Option Strict On (the default, as in the test
> source where the directive is omitted, is Off).
>
> Regards,
>
> On 10/31/05, Miguel de Icaza <miguel at novell.com> wrote:
> > Hello,
> >
> >     The code in that revision for UnboxCast looks suspiciously wrong.
> > It creates an empty object if child expression leaves a null on the
> > stack.
> >
> >     Also, it would be convenient if you added a test case that showed
> > this problem.
> > --
> > Miguel de Icaza <miguel at novell.com>
> > Novell, Inc.
> > _______________________________________________
> > Mono-devel-list mailing list
> > Mono-devel-list at lists.ximian.com
> > http://lists.ximian.com/mailman/listinfo/mono-devel-list
> >
>
>
> --
> Rafael "Monoman" Teixeira
> ---------------------------------------
> I'm trying to become a "Rosh Gadol" before my own eyes.
> See http://www.joelonsoftware.com/items/2004/12/06.html for enlightment.
> It hurts!
>


--
Rafael "Monoman" Teixeira
---------------------------------------
I'm trying to become a "Rosh Gadol" before my own eyes.
See http://www.joelonsoftware.com/items/2004/12/06.html for enlightment.
It hurts!



More information about the Mono-devel-list mailing list