dotgnu-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [DotGNU]fxcop


From: Gopal V
Subject: Re: [DotGNU]fxcop
Date: Fri, 30 Apr 2004 06:06:09 -0700 (PDT)

Hi,

> >do you know FxCop?

That's an Microsoft tool right ?..

Compare 

if(val.Length == 0)

and 

if(val == String.Empty)

tell me which gives an exception when val is null ?

The only change we can do is replace all "" with a 
String.Empty ... (that is a direct pointer load 
operation in CVM ... no constructors called)

The other change is essentially to be made manually
as per the scenario .. FxCop points them out for us.

String equals in abstract terms would be "return
(str1->length == str2->length) &&
(memcmp(str1->buf,str2->buf))" .. so String.Empty
should be reasonable enough.

That all said CVM/JIT should be able to make the
change at runtime ... rather than at compile time .
(eg see null check removal in libjit).

Gopal
PS: please check System.Xml for this case of == "" :)


        
                
__________________________________
Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs  
http://hotjobs.sweepstakes.yahoo.com/careermakeover 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]