[Mono-list] Important difference with Microsoft compiler

Gustavo García Bernardo ggb@tid.es
Fri, 14 Mar 2003 12:26:01 +0100


I copy&paste only this part of the code, the complete code is:


//This compile with mono but doesn't with Microsoft

using System;

namespace ConsoleApplication1
{
class Class1
{
static void Main(string[] args)
{
  for (int i=0;i<10;i++)
  {
    A a = new A();
  }
  A a = new A();
}
}
class A
{
}
}



> -----Mensaje original-----
> De: mono-list-admin@lists.ximian.com
> [mailto:mono-list-admin@lists.ximian.com]En nombre de Erik Bågfors
> Enviado el: viernes, 14 de marzo de 2003 11:24
> Para: Gustavo García Bernardo
> CC: mono-list@lists.ximian.com
> Asunto: Re: [Mono-list] Important difference with Microsoft compiler
>
>
> I don't think that having a Main outside of a class is legal in c#.  I
> can't see how this should compile on any c# compiler.  I sure doesn't
> compile under mcs for me.
>
> : [bagfors@detrius]$ ; mcs test5.cs
> syntax error, expecting CLASS DELEGATE ENUM INTERFACE STRUCT
> test5.cs(5) error CS-0025: : Parsing error
> Mono.CSharp.yyParser.yyException: irrecoverable syntax error
> in <0x00701> 00 Mono.CSharp.CSharpParser:yyparse
> (Mono.CSharp.yyParser.yyInput)
> in <0x00075> 00 Mono.CSharp.CSharpParser:parse ()
>
>
>
> /Erik
>
> On Fri, 2003-03-14 at 09:52, Gustavo García Bernardo wrote:
> > Hi everybody,
> >
> > 	The next code doesn't compile with Microsoft compiler but
> compiles with
> > mono mcs:
> >
> > class A
> > {
> > };
> > static void Main(string[] args)
> > {
> > for (int i=0;i<10;i++)
> > {
> >    A a = new A();
> > }
> >
> > A a = new A();
> > }
> >
> > I think the right operation is in mono. Is this documented?
> >
> > G.
> >
> > _______________________________________________
> > Mono-list maillist  -  Mono-list@lists.ximian.com
> > http://lists.ximian.com/mailman/listinfo/mono-list
> /Erik
>
> --
> erik@bagfors.nu
> fingerprint: 6666 A85B 95D3 D26B 296B 6C60 4F32 2C0B 693D 6E32
> _______________________________________________
> Mono-list maillist  -  Mono-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list