CS 3733 Operating Systems, Spring 2004 Assignment 0 Comments
These comments refer the the valid_program_line function:
- Check all characters for validity
- avoid unusual constructs
- avoid unusual arguments
- understand the meaning of NULL
- avoid defining your own macros
- avoid using the is-macros
- avoid hard coding of ASCII values
- avoid else after return
- never include tab characters in character or string constants
- avoid excessive indentation
- avoid code that has no effect
- at most one statement per line
- The null character is not any different from other invalid characters
- If you use a finite state machine (FSM) solution, define the states
- avoid obscure programming
- avoid C++ type comments in C source
- use proper indentation
Testing
Some cases to test for:
- Empty line: just newline
- Starts with period
- Starts with blank
- 1 digit in program number
- More than 10 digits
- space between digits and period
- tabs anywhere
- null characters anywhere
- No blank after period
- Multiple blanks after period
- blanks in program description
- blanks before final newline
- carriage return before newline