Skip to main content
gamedev.net
🔒 Locked

How much integrity checking???

Started by Noods 3 replies 300+ views
Original Post
Noods
Noods
In coding my current program, I find that I am writing integrity checks everywhere possible. How much integrity checking is optimal? Is there a time when I shouldnt worry about integrity checking?
duke
duke
Any reasonably large program will need and have some form of integrity checking (or exception handling). But if you find yourself checking all over the place then what that means is you don''t have a clear picture of how the program is supposed to work and you are compensating by doing checks ALL the time just to cover your butt... this actually isn''t all that bad during debug but generally it needs to be avoided.

What language are your coding in? If it provides a mechanism of dealing with and detecting errors, then my first suggestion is to use that. Even still you need to have a clear idea of what points in your code the checks need to be at.

super genius
Noods
Noods
I basically make a check that everything is ok at each point where the program could unexpectedly crash. i.e.

//create tab control

//generate an error and bail if tab control couldnt be created

//create DirectPlay

//generate an error and bail if Directplay couldnt be initialized

//create childwindow

//generate an error and bail if couldnt create the child window


I do this because I have had problems when running a program on a different machine then my own, and it would close unexpectedly without any sign of what the problem is. With these checks, I (or the user) am able to tell what the problem is (old version of directx etc) I just find that Im doing the checks a lot

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.