Enable all the warnings your compiler can produce.
And mind the warnings. If you can, treat them as errors!