[Mono-list] Minor bug
Pablo Baena
pbaena@uol.com.ar
26 Apr 2003 19:42:26 +0000
--=-iG5lR/TxDxN7h1AikN3l
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
This fails to build on mcs and csc, but in .NET it shows a more
descriptive error message:
"Embedded statement cannot be a declaration or labeled statement".
I will fill a bug report but I have another question. Let's say I put
the brackets and the code compiles. One object's lifetime is only within
its scope (in this case the said brackets). But, what if this class I
created here has a delegate called by an event on another permanent
class beyond this scope?? The GC knows this and won't kill my newly
created object until the caller class is finalized?
Cheers!!!
using System;
class Clazz
{
}
public class IsTest
{
public static void Test (object o)
{
if (o is Clazz)
Clazz a = new Clazz();
}
public static void Main()
{
Clazz c1 = new Clazz();
Test (c1);
}
}
--
Pablo Baena <pbaena@uol.com.ar>
--=-iG5lR/TxDxN7h1AikN3l
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 7bit
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/1.1.7">
</HEAD>
<BODY>
This fails to build on mcs and csc, but in .NET it shows a more descriptive error message:<BR>
"Embedded statement cannot be a declaration or labeled statement".<BR>
<BR>
I will fill a bug report but I have another question. Let's say I put the brackets and the code compiles. One object's lifetime is only within its scope (in this case the said brackets). But, what if this class I created here has a delegate called by an event on another permanent class beyond this scope?? The GC knows this and won't kill my newly created object until the caller class is finalized?<BR>
<BR>
Cheers!!!<BR>
<BR>
<BR>
<PRE>using System;
class Clazz
{
}
public class IsTest
{
public static void Test (object o)
{
if (o is Clazz)
Clazz a = new Clazz();
}
public static void Main()
{
Clazz c1 = new Clazz();
Test (c1);
}
}</PRE>
<TABLE CELLSPACING="0" CELLPADDING="0" WIDTH="100%">
<TR>
<TD>
-- <BR>
Pablo Baena <<A HREF="mailto:pbaena@uol.com.ar">pbaena@uol.com.ar</A>>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>
--=-iG5lR/TxDxN7h1AikN3l--