Reputation
3,545
Top tag
Next privilege 5,000 Rep.
Approve tag wiki edits
Badges
11 27
Impact
~250k people reached

  • 0 posts edited
  • 3 helpful flags
  • 48 votes cast
Apr
12
comment Why do bitwise operators have lower priority than comparisons?
Oh. So the meaning of & changes depending on where you place it. For a=1; b=2; if(a & b){...}` will execute the block, while c = a & b; if(c){...} will consider the condition not satisfied. Big thanks to mr. Richie for fixing that.
Apr
12
comment Why do bitwise operators have lower priority than comparisons?
@Dunk: The common "by hunch" approach is [arithmetics] [logic operator] [arithmetics]. Most programmers don't create a mess of parentheses like if(((x+getLowX()) < getMinX) || ((x-getHighX())>getMaxX()))) - most will assume precedence of arithmetics over logics and write if( ( x + getLowX() < getMinX ) || ( x - getHighX() > getMaxX() )) assuming precedence of + above <. Now intuitively if( x ^ getMask() != PATTERN ) should behave the same, XOR being arithmetic operator. The fact it's interpreted as if( x ^ ( getMask() != PATTERN ) ) is completely counter-intuitive.
Apr
11
comment How meaningful is the Big-O time complexity of an algorithm?
It is important to realize that constants can be quite important. O(n) where single iteration takes a second may be worse than O(n log n) where you get a million iterations per second.
Apr
11
answered Is it allowed to make multiple instances of a singleton class?
Apr
11
awarded  Nice Question
Apr
11
accepted Why do bitwise operators have lower priority than comparisons?
Apr
11
revised Why do bitwise operators have lower priority than comparisons?
the counterexample wasn't boolean.
Apr
11
comment Why do bitwise operators have lower priority than comparisons?
Wouldn't that fail if c=2 Or did a==b result in ~0 and not 1?
Apr
11
comment Why do bitwise operators have lower priority than comparisons?
@Gnat: I guess, following dan1111's comment, my answer is no longer required?
Apr
11
asked Why do bitwise operators have lower priority than comparisons?
Feb
28
revised Try to find a word in the dictionary that has most letters given
conflicting variable names 'index'
Feb
28
answered Compiling multiple languages and Javascript
Feb
28
revised Try to find a word in the dictionary that has most letters given
added 205 characters in body
Feb
28
answered Try to find a word in the dictionary that has most letters given
Feb
26
comment How can I deal with a team member who dislikes making comments in code?
I'd say "give him a taste of his own medicine", task him with fixing/debugging/extending a piece of code some other non-commenting predecessor has left...
Feb
25
awarded  Constituent
Feb
25
awarded  Caucus
Feb
22
answered When would using a scripting language within a larger program be useful?
Jan
25
answered terms for the html/css/javascript model?
Jan
22
awarded  Pundit