Abraxas Software (R) CodeCheck Windows NT version 12.40 B1 Checking extended ANSI C file v542k.c with rules from vss542.cc: 1 /* 2 3 5.4.2 Assessment of Coding Conventions 4 K. Has no line of code exceeding 80 columns in width (including comments and 5 tab expansions) without justification; 6 */ 7 8 // bad long line 9 int fookkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk; -------> AB A: Warning W0542: VSS 5.4.2 S - Initialize every variable upon declaration B: Warning W0542: VSS 5.4.2 K - Lines must not exceed 80 characters 10 Checking extended ANSI C file v542r.c with rules from vss542.cc: 1 /* 2 5.4.2 Assessment of Coding Conventions 3 r. Has functions with fewer than six levels of indented scope, counted as 4 follows: 5 */ 6 7 8 int function_v542K() 9 10 { 11 if (a = true) 12 //1 13 { 14 if ( b = true ) 15 //2 16 { 17 if ( c = true ) 18 //3 19 { 20 if ( d = true ) 21 //4 22 { 23 while(e > 0 ) 24 //5 25 { 26 //code 27 } 28 } 29 } 30 } 31 } 32 } 33 34 int function_v542K_bad() 35 36 { 37 if (a = true) 38 //1 39 { 40 if ( b = true ) 41 //2 42 { 43 if ( c = true ) 44 //3 45 { 46 if ( d = true ) 47 //4 48 { 49 while(e > 0 ) 50 //5 51 { 52 if ( f > 0 ) { exit(); } // six, ILLEGAL -------> A A: Warning W0542: VSS 5.4.2 R - No more than six levels of indented scope 53 } 54 } 55 } 56 } 57 } 58 } Checking extended ANSI C file v542s.c with rules from vss542.cc: 1 /* 2 vss 542s. Initializes every variable upon declaration where permitted 3 */ 4 5 // global 6 7 int foo = 1; //good 8 9 int foam; // bad -------> A A: Warning W0542: VSS 5.4.2 S - Initialize every variable upon declaration 10 11 // local 12 v8() { 13 14 int foo = 1; // good 15 16 int foam; // bad -------> A A: Warning W0542: VSS 5.4.2 S - Initialize every variable upon declaration 17 } Checking extended ANSI C file v542u.c with rules from vss542.cc: 1 /* 2 vss542u. Has all constants other than 0 and 1 defined or enumerated, or shall have a -------> A A: Warning W0542: VSS 5.4.2 K - Lines must not exceed 80 characters 3 comment which clearly explains what each constant means in the context of 4 its use. Where “0” and “1” have multiple meanings in the code unit, even 5 they should be identified. Example: “0” may be used as FALSE, initializing 6 a counter to zero, or as a special flag in a non-binary category. 7 */ 8 9 // good cases 10 11 #define FOURLETTERWORD 100 12 #define NULL 0 13 14 char my_array[FOURLETTERWORD]; // is fine -------> A A: Warning W0542: VSS 5.4.2 S - Initialize every variable upon declaration 15 16 int beginTime; -------> A A: Warning W0542: VSS 5.4.2 S - Initialize every variable upon declaration 17 beginTime = time (NULL); 18 19 int array[100]; // good, has comment -------> A A: Warning W0542: VSS 5.4.2 S - Initialize every variable upon declaration 20 21 // BAD CASES FOLLOW .... 22 23 24 char my_array2[4]; -------> A B A: Warning W0542: VSS 5.4.2 U - Enumerate all constants not zero or one B: Warning W0542: VSS 5.4.2 S - Initialize every variable upon declaration 25 int array[100]; -------> A B A: Warning W0542: VSS 5.4.2 U - Enumerate all constants not zero or one B: Warning W0542: VSS 5.4.2 S - Initialize every variable upon declaration 26 27 int dog = 100; -------> A A: Warning W0542: VSS 5.4.2 U - Enumerate all constants not zero or one 28 29 char my_array1[4]; -------> A B A: Warning W0542: VSS 5.4.2 U - Enumerate all constants not zero or one B: Warning W0542: VSS 5.4.2 S - Initialize every variable upon declaration 30 Checking extended ANSI C file v542v.c with rules from vss542.cc: 1 /* 2 542 v. Only contains the minimum implementation of the “a = b ? c : d” syntax. 3 Expansions such as “j=a?(b?c:d):e;” are prohibited. 4 */ 5 6 f542v() { 7 8 a = b ? c : d ; // even the usage of this is questionable, the use of nested is illegal -------> A B A: Warning W0542: VSS 5.4.2 V - Condition C/C++ may be considered prohibited B: Warning W0542: VSS 5.4.2 K - Lines must not exceed 80 characters 9 }