Programming Errors
From dis-Emi-A
Contents |
Problems
This is a catalog of the problems/defects/issues that appear while writing programs in other languages. The goal of this new lanaguage is of course to make all these problems not possible.
Resource Problems
- not freeing memory (Solved by Memory Management)
- invalid ptr (Solved by Optional Variables)
- out-of-bounds (Solved by Constrained Types)
- buffer overflow (Solved by Constrained Types)
- overstepping array boundaries
- too few/too many objects iterated
- pointer vs. value parameter passing (Solved by parameter passing and multiple return values)
- forgetting to declare variables (Solved by Automatic Types)
- uninitialized variables (Solved by Memory Management)
- incorrect initialization (C/C++ impossible struct syntax)
- pointer loops
- memory bit-ordering/binary file types
- varying fundamental type sizes
- return of local variables
- incorrect variables/scope problems
Logic Problems
- infinite loop
- unscreened/dirty input to protected function
- -security errors
- half-completed calculations/procedures
- -breaks/exceptions in middle
- -possibly irreversible
- concurrent modifications
- thread [dead]locking
- non-atomic modifications
- wrong if/conditional/while flow (ex. error_bad_return)
- semicolons on for/while loop (empty loops)
- contradictory/impossible conditions
- dead/unusued code
- uninitialized variables
- unintended code execution
- forgetting a "break" statement
- using = instead of ==
- misplaced brackets, (added code to single line conditions)
- undeclared functions
- missing header files
- multiple declarations / conflicts
- ignored error conditions
Conversion Problems
- multiply encoded text
- display( encUTF8( str ) );
- func display( str ) { write( encUTF8( str ) ); }
- incomplete types (also with conversions) (Solutions: Subtypes)
- speed = 4
- mass = 5
- newmass = speed * mass //conversion error (not seen by compiler)
- =>
- speed = 4m/s
- mass = 5kg;
- newmass = speed * mass //compiler error (will be caught)
- corrupt files / unchecked input
- missing datatypes from serialization
- incorrect comparisions (ptrs, classes, strings, etc.)
Side-Effect Problems
- uninteded modiftion
- if( a = 0 ) ...
- if( b.hasSideEffect() ) ...
Calculation Problems
- uncaught/unnoticed overflow (Solution: Constrained Types)
- uncaught/unnoticed underflow
- integer division/loss of precision
Maintainence/Meta Problems
- Code duplication large and small
- odd-flow
- outdated comments
- -constraints/restrictions/expectations in comments rather than code
- name clashes
- include files/imports
- name codependencies
- multiply defined types
- non-terminating comments (missing code)
- incorrect token use ( a != b vs. b != a, 0 < a < 5 )
- type-unsafe/unchecked macros
- reliance on expresison evaluation ordering (in comparisions, as parameters, etc...)
