Building Solid Code by Wes Faler Example 1: void log_prtf(const char *outdata) { FILE *log_fp = fopen("log.log","at"); if(log_fp) { char buffer[40]; time_t t; time(&t); strcpy(buffer,ctime(&t)); #ifndef _WINDLL sprintf(buffer+24," - %ld - ",(long)clock()); #else strcpy(buffer+24," - "); #endif fputs(buffer,log_fp); fputs("\n",log_fp); fclose(log_fp); } } Table 1: -t4 // tab size of four spaces -e502 -e713 -e737 -eau // don't report on signed/unsigned mismatches -e734 // allow sub-integer loss of information -e701 -e703 // shifting int left is OK -e537 // don't report on repeated includes // (since we use header file guards) -e763 // don't report on redundant declaration for symbol -e1712 // don't report on lack of default constructor -e783 // OK not to end the last line with a new-line -e1502 // OK if a class has no data members -e1714 // OK if member functions are not referenced -e755 // OK if global macros are not referenced -e1711 // OK if virtual with a derived class. Probably // for future expansion. -e714 // OK if external symbol is not referenced -e765 // OK if external symbol could be made static. // May want for future expansion. -e1526 // function not defined is OK since the // linker will catch -e731 // Boolean argument to equal / not equal is OK -e1702 // Operator is both ordinary function and // member function is OK -e754 // Local structure not referenced is OK -e769 // Global enumeration constant not referenced is OK +fce // Continue past #error statements -e309 // #error off -e1704 // OK to have private constructors, since // we're just restricting their use -e1722 // OK for operator= not to return reference, // since its probably in private anyway 1