Path: chuka.playstation.co.uk!news From: "pal" Newsgroups: scee.yaroze.freetalk.english Subject: Re: how to make my code crash-proof? Date: 21 Feb 2002 01:31:58 GMT Organization: PlayStation Net Yaroze (SCEE) Lines: 33 Message-ID: <01c1ba76$b5823080$dd88933e@pal-s-omnibook> References: <01c1ba1b$e134c5e0$4d8a933e@pal-s-omnibook> NNTP-Posting-Host: nas-cbv-3-136-221.dial.proxad.net X-Newsreader: Microsoft Internet News 4.70.1155 Chris Wallace wrote in article ... > I know very little, so feel free to ignore me.. Any ideas are welcome :) > but on divide errors, would > it not be enough to ensure that any 0 values being passed to a divide are > incremented? In the case of divides, I could as you suggest add a check against 0 for every / or % operator I can find, although that would be painful (since the code is already written). But this method would not be practicable for invalid pointers (I'd have to check for every memory access !)... Also, this would only work for the code I have the sources for, not the whole program (well this shouldn't be a problem but i'm looking for absolute safety) Of course I did write my code in such a way that divide by zero's should not occur (but you're never sure). Actually the true enemy is the pointer. And solving the pointer problem may help solve the divide one. > I'm guessing you want something which checks it a bit deeper. Divides by 0 > produce an infinite value, could you check for these somewhere? I don't know about the PS specifically, other than that it freezes when divby0s occur (that was easy to check :) ) -- that means no value is produced here; but I expect it should raise an interrupt. The official docs don't seem to deal with that kind of stuff however. pal