strategies for reducing programming errors
use assert
use assertalthough i haven't done this myself within wxwidgets, it is good practice to use assert statements liberally, that check for conditions that should or should not hold, and print out appropriate error messages. these can be compiled out of a non-debugging version of wxwidgets and your application. using assert is an example of 'defensive programming': it can alert you to problems later on.
use wxstring in preference to character arraysusing wxstring can be much safer and more convenient than using wxchar *. again, i haven't practiced what i'm preaching, but i'm now trying to use wxstring wherever possible. you can reduce the possibility of memory leaks substantially, and it is much more convenient to use the overloaded operators than functions such as strcmp. wxstring won't add a significant overhead to your program; the overhead is compensated for by easier manipulation (which means less code). the same goes for other data types: use classes wherever possible.
|