[Mono-list] Suggestion: warning "member variable not initialized"

Brian Deacon brian@navelplace.com
08 Jun 2003 11:29:22 -0700


Ugh... how very slashdot of me to talk out of my !@#$%^&*() like that. 
I'm officially cutting down my slashdot time starting today.  :)

Interesting lesson, however.  I was speaking ex-rectum by just assuming
that this error was universal:

void SomeMethod(){
	int i;
	Console.WriteLine( i );  //blows chunks
}

Are there any other situations of implied initialization?  (Err, the
above being an example of no-implied-initialization.)

Brian


On Sat, 2003-06-07 at 13:35, Marcus wrote:
> On the contrary, "structs should be designed to consider the default 
> initialization a valid state." In particular, the default initialization sets 
> "all value type fields to their default value and all reference type fields 
> to null."
> 
> In the particular case of System.DateTime, a default-initialized instance 
> corresponds to 1/1/0001 12:00:00 AM.
> 
> 
> On Saturday 07 June 2003 3:23 pm, Brian Deacon wrote:
> 
> > Umm... no.
> >
> > Some [ValueType] types don't even have an equivalent to 0 or null.
> > e.g., System.DateTime, IIRC.
> _______________________________________________
> Mono-list maillist  -  Mono-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list