[Mono-list] mcs compilation of xsp.exe is a little strange...
Francisco Figueiredo Jr.
fxjrlists@yahoo.com.br
Sun, 28 Jul 2002 13:44:58 -0300 (ART)
--- "Francisco Figueiredo Jr." <fxjrlists@yahoo.com.br> escreveu: > ---
Miguel de Icaza <miguel@ximian.com> escreveu:
> > Can you create a simple small test case in C# that
> > we could use to track
> > this down?
>
> Sure! I will try to get something soon.
>
>
Here is the little test case which shows this strange behavior.
As this is my first test case, please, let me know if I'm doing it the right
way.
I tried many variations, but it seems that if there is any object creation, all
the code before it is left behind. If it is used an "indirect" object creation,
like Console.WriteLine(new Object()) for example, there is no problem.
Also, as stated below, if braces ('{') are used all the code is generated
correctly.
Thanks.
/*
This test shows an strange behavior of mcs when compiling switch statements.
Note that when the code below is compiled, the lines from [1] to [2] aren't
generated. Only lines from [2] and later are generated.
Note also that if braces are used, all the lines are generated correctly.
Author:
Francisco Figueiredo Jr. fxjrlists@yahoo.com.br
*/
using System;
public class Test
{
public static void Main(String[] args)
{
Int32 i = 5;
Int32 a;
switch (i)
{
case 1:
Console.WriteLine("In case 1:");
break;
case 3:
Console.WriteLine("In case 3:");
break;
case 5:
//[1]
Console.WriteLine("In case 5:");
a = 10;
Console.WriteLine("a: " + a);
//[2]
Object c = new Object();
Console.WriteLine("In case 5: after create object");
break;
default:
Console.WriteLine("default");
break;
}
}
}
=====
Regards,
Francisco Figueiredo Jr.
_______________________________________________________________________
Yahoo! PageBuilder
O super editor para criação de sites: é grátis, fácil e rápido.
http://br.geocities.yahoo.com/v/pb.html