This is the set of comment codes I use to mark your programming assignments. You will find these code words printed on your program listings. If you have further questions, post your question to the course news group, send me email, or come see me during Lab time or office hours.
CODE | Meaning |
---|---|
ALG | Not in Algonquin College coding standard format (missing comments, wrong indent style, etc.) |
BOUND | Array or pointer address out-of-bounds. If declared as x[10] don't use x[10] = value or x[-1] = value. Make sure all loops stop at array boundaries. |
COU | Use a fixed-width font for program listings, such as Courier, so that everything lines up on paper. |
COM | Faulty comment style. Missing comments, too many comments, or redundant comments. |
DEF | Use meaningful UPPER_CASE #define (or enum) for all numbers and constants |
DOS | Don't use DOS- or Windows-specific functions. Write portable code. |
DUP | Duplicated code -- should be combined. Less code is better code. |
EOF | Missing or mishandled test for EOF sentinel value (-1) or EOF condition. Don't continue to read input streams that have hit EOF unless you can clear the EOF condition. |
ERR | Put names and sizes of bad data in error messages; don't just say "too big" or "can't open". Print an error message before exiting a program due to an error. |
FAT | Failure to handle a fatal error. Failure to indicate that something failed. Don't keep going if something fatal happens; exit the program or return an error code to the calling function or operating system. |
FMT | Brace alignment, indentation, line length, font, printer, or other formatting problems. |
ID | Assignment is not identified according to course guidelines. Follow the directions. |
INIT | Using variables (especially pointers) before initializing them. |
INP | Read input in only one place, not spread around in the code. |
INT | Functions fgetc() and getc() return an integer, not a character. This is needed for the EOF test. |
LOOP | Avoid huge long loops and nested constructs going over page boundaries. |
MEM | Probable memory corruption. Using freed memory; using a NULL pointer; pointer confusion; missing free(); duplicate free(); etc. |
MIS | Missing or incomplete program header or comment, or header does not match code or assignment requirements. |
NAM | Poor names for identifiers (length/similarity/meaning, etc.). |
NUL | Confusion between char '\0' and pointer NULL and integer 0 and Boolean FALSE or '!'. |
OPN | Don't close files that may not be open. |
OUTP | Output or code/algorithm doesnt conform to given assignment specifications. |
OVR | Incorrect or missing check for buffer overflow; program will fault on some input. |
PER | Use perror() or strerror() to give the real error message for this error; or, don't use perror() or strerror() for errors that are not system errors. (Out of memory is not a system error.) |
PRT | Printing or storing unprintable characters; use isascii() and isprint() as needed. |
PTR | Clumsy pointer syntax. Use ptr[count] rather than *(ptr + count). |
RET | No check for return value of function, especially fclose() and malloc(). |
SIM | Simplify this code. |
SIZE | Pass in as arguments the sizes of buffers to functions that use the buffers (to prevent overflow). |
STK | Function returns a pointer to local stack storage; this is forbidden. |
TST | Missing, vague, or incomplete assignment testing strategy. |
TTY | Only clear EOF if reading from a terminal (see isatty()) |
TYP | Type mismatch (e.g. char */int, void/int, etc.). |
UNK | Incorrect, missing, redundant, unknown, or unnecessary code or feature. |
UNR | Unreadable printout. Poor print quality, incorrect stapling, indecipherable writing, etc. |
UPR | #define and enum constants are always ALL_UPPER_CASE (the only use of all upper case); variables, typedefs, function names, etc. are lower- or mixed-case |
YEL | DON'T YELL ERROR MESSAGES AT YOUR USERS; use mixed-case messages, avoid exclamation points, and don't blame the users for everything! |