Log Files
Log4c
Assertions
Lint
Core Dumps
Conditional Compilation
define DEBUG
…
#ifdef DEBUG
printf(“%s(%d):z$d\n”,FILE,LINE,z);
#endif
Debug and Release Builds
Debug builds
- do more checking of error conditions
- in debug mode, code is compile such that:
- it does not optimize the code to make it as fast as possible
- it might include additional runtime checks
Release Builds
- faster but dont do checking
Compiled vs Interpreted
Compiled
- compiler goes through the whole program at once before it runs
- Detects problems before the program ever runs
Interpreted
- Program is run line by line
- Program is parsed only just before line is executed
- Problems are not detected until line is executed
- Rarely executed lines can make it to production with bugs in them because they were never executed
Strongly Typed vs Weakly Typed
Strongly Typed
- All assignments and function calls are check to make sure the right types are used
- Errors detected at compilation time
Weakly Typed
- Variables and parameters can accept any type
- Type mismatches may not be detected until runtime.
- Errors in infrequently executed lines may remain undetected for a long timer.