[Mono-list] mcs bug, using non-initialized static member variables?

A Rafael D Teixeira rafaelteixeirabr@hotmail.com
Mon, 10 Jun 2002 15:50:48 -0300


I wrote:
> > 1 - doing nothing: the runtime initializes objects to null (for
> > value types
> > it not advisable to do that).
> >
> > .. private static int counter;
>

Talbott Crowell, asked:
>Why is is not advisable to do that?  Should all static value type
>variables be explicitly initilized to work properly in Mono?  Is
>this a temporary issue?

Itīs not usual, but some classes can be marked not to have the 
'BeforeFieldInit' flag, what makes itīs members not being automatically 
zeroed. For instance MonoBASIC (VB.NET) "Module"s are sealed static classes 
that do not have the BeforeFieldInit flag (see TypeAttributes enumeration on 
.NET documentation, for others flags).


Rafael Teixeira
Brazilian Developer


_________________________________________________________________
Join the world’s largest e-mail service with MSN Hotmail. 
http://www.hotmail.com