Submitted by Lobby Jones (not verified) on Fri, 06/19/2009 - 13:34.
Knowing the difference means knowing to use (int) on one side of == to explicitly cast.
Some languages will automatically infer type + value comparison so 'x' == 0 is not true where (int) 'x' == 0 is true.
If you step back from arguing the point on technical merit and think about "what does the user intend", then one would expect 'x' == 0 to be false unless explicitly telling the interpreter to do otherwise.
knowing v. doing
Knowing the difference means knowing to use (int) on one side of == to explicitly cast.
Some languages will automatically infer type + value comparison so 'x' == 0 is not true where (int) 'x' == 0 is true.
If you step back from arguing the point on technical merit and think about "what does the user intend", then one would expect 'x' == 0 to be false unless explicitly telling the interpreter to do otherwise.
nom nom nom