3,384 reputation
826
bio website
location
age
visits member for 3 years, 1 month
seen Jul 23 at 12:04

Jul
29
comment Does modular programming affect computation time?
Premature optimization is the root of all evil. Linear code is slightly faster than modular code. Modular code is vastly faster than spaghetti code. If you aim at linear code without a very (VERY) thorough project of the whole thing, you'll end up with spaghetti code, I guarantee that.
Jul
15
awarded  Informed
Jul
5
awarded  Yearling
May
16
awarded  Popular Question
May
6
awarded  Popular Question
Apr
17
awarded  Nice Answer
Apr
16
awarded  Good Question
Apr
12
comment Why do bitwise operators have lower priority than comparisons?
@Dunk: I don't know about you but I remember multiplication/division/AND has priority over addition/substraction/OR, and remembering "arithmetic above logic" is exactly one bit of information. Besides, there's a chart of operator precedence hanging on the wall by me, just in case - and the only simplification the "mess" example needs to be clear is removal of the redundant parentheses. And as for "concerned with solving problem at hand" - neglecting code clarity at that phase tends to bite you in the back while maintaining the code.
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