Programming Guidelines (for C and C++)
TL-1: Warning free code (C, C++)
If you think you are smarter than your compiler, you are probably wrong.
All code should compile without generating warnings. Furthermore, you should set your compiler to its highest warning level (to report even more warnings). Some compilers have an option to treat all warnings as errors. If your compiler has this option use it. This will force you to address the problem immediately - and not put it off until later.
Although many warnings are benign and it may seem silly to remove them do not give in to the temptation. If each compile has hundreds of 'useless' warnings flying by it will be nearly impossible to see that one new potential bug-causing warning that was introduced by your latest code.
Do not add pragmas or other means to disable or circumvent a warning in your code... even if you know you are correct. It is better to write less-elegant code in these few instances than to open Pandora's box.
Unfortunately, there are always some exceptions to the rule. A common idiom to create multi-line macros in the following way:
#define f \
do { \
// function body \
} while(0)
This is perfectly acceptable. However, some compilers will generate a warning.