For example, a common error in C/C++ is to use the assignment operator
= instead of the comparison operator
|show 3 more comments|
closed as not constructive by Aaronaught, Walter, user281377, Dori Jul 3 '11 at 3:05
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or specific expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, see the FAQ for guidance.
In .NET languages adding of event handlers multiple times.
This usually comes down to putting the code that adds them somewhere that gets called multiple times.
There are two solutions:
(I am guilty of this one myself).
Typos How come no one said anything about typos Are all of them that much confiednt oops did it again
In VB, forget that
If you don't implement all your abstract functions, you get an abstract error!
I'd imagine most compiler's will toss you a warning or not let you compile, but I've gotten this once or twice when I thought I was safe.
C's returns the result it has as soon as it finds the first null character (denoting the end of the string) so:
actually returns success. You need to remember it's equivelent to "starts with" in other languages and you need to do:
(essentially check the length of the strings match as well.
(obviously you wouldn't check passwords unencrytped. Those would be md5 strings you compare or something else)
Omitting the curly brackets in C#'s switch statement got me once when I first started programming:
Excerpt from Eric Lippert's blog:
Switch blocks also define their own declaration spaces, but switch sections do not:
You can solve this problem in a number of ways; the easiest is probably to wrap the body of the switch section in curly braces:
which tells the compiler "no, really, I want these to be different declaration spaces".