Tuesday 15 January 2013

c# - Why do a bitwise and? -



c# - Why do a bitwise and? -

there no problem code i'm curious. have code i'm looking @ , i'm trying figure out why bitwise , and not regular &&

bool bvalid = true; .... // code here bvalid &= isasmconfigurationvalid(this.m_thisdevices[bdcasm], ref el); .... // more code here bvalid &= isspeconfigurationvalid(this.m_thisdevices[bdcspe], ref el);

i want know why did instead of setting bvalid = isconfigvalid. coding style.

i can see options:

lazyness - why type bvalid again? lets utilize &= avoid writing again. optimization - bvalid evaluated 1 time (http://msdn.microsoft.com/en-us/library/e669ax02.aspx) randomness

remember there no bitwise operation bool operand, logical and.

all personal, best reply come real developer.

c# bitwise-and

No comments:

Post a Comment