I created very few of these guidelines on my own.Some i learned from experience others i learned from my fellow team members or good books or some great forums on the net.My knowledge is no where near complete so there can be mistakes,feel free to correct them and your feedback is greatly anticipated.This is a book i highly recommend and it is not tied to any particular language.And irrespective of your domain i hope you will find it a good read.The Practice of Programming
For all these examples i will be using Microsoft Visual C++ 2010 Express edition(Provided free of charge by Microsoft)VS 2011
U can use VS 2011 without any problem.
(Free again) as a lint tool.A little about lint http://en.wikipedia.org/wiki/Lint_%28software%29
Basically Cppcheck is a static code analyzer for C/C++ code.More on this later
Almost all the beginners make this mistake in C/C++
Once experienced, this painful(but hard to catch) error (doing an assignment where comparison was intended) is rarely
repeated. Some programmers have developed the habit of writing the literal first, like this: if
. Then, if an equal sign is accidentally left out, the compiler will throw an error
"left operand must be l-value."(from VS 2010)This error means u can't assign a value to a literal. This won't protect you when comparing two variables, but every little bit helps.
U can see that there are no syntactical errors when u write if(i=6) but a logical error has occurred.Another thing tools are not substitute for shoddy programming,good programming habits makes your life a hell lot easier.