Code cleanup: Difference between revisions

Jump to navigation Jump to search
m
m (not really been updated in a while)
 
Line 28: Line 28:
== Persistent Checklist ==
== Persistent Checklist ==
=== Carelessness ===
=== Carelessness ===
* Properly allocate and deallocate memory using malloc/new/new[{][}] and free/delete/delete[{][}]. Valgrind is helpful when looking for these.
* Properly allocate and deallocate memory using malloc/new/new[] and free/delete/delete[]. Valgrind is helpful when looking for these.
* Close any open file streams when you're through with them. Take care to not write to or close streams that aren't open. Avoid this by initializing file pointers/handles with 0 before use and verify that it is not 0 before accessing/closing.
* Close any open file streams when you're through with them. Take care to not write to or close streams that aren't open. Avoid this by initializing file pointers/handles with 0 before use and verify that it is not 0 before accessing/closing.


4

edits

Navigation menu