suchismit mahapatra wrote: > On 6/5/07, Thomas Hruska <[EMAIL PROTECTED]> wrote: > suchismit mahapatra wrote: >>> What are the possible causes of a piece of C code crashing and that too > in >>> different points of the code when it is executed, given that it uses just >>> the standard C libraries and is single threaded. >>> Where should one look for the flaws? > >> Write code such that it can't crash in the first place. Read Safe C++ >> Design Principles (free e-book for c-prog members). > > Thomas, using the design principles is ok in its place (agree that they > must be adhered to) but what I am saying here what if we have a piece of > code which acts like a madman (won't even reject the possibility of some > madman writing it) and we have been given the task of kinda rectifying it, > seeing what's wrong with it. What are the places we need to look to? given > that we know the following: > i) single threaded application > ii) uses standard C libraries > iii) crashes at different locations whenever its run. > > My programming sense somehow tells me about the possibility of a corrupted > library or even the memory. Or even segment encroachment or stack assignment > errors. Wanted to know others' views about what could have happened, the > symptoms being so typical, i.e. crashes at diff locations. Would love to > hear from everyone who had even a near similar experience.
An application crash is usually the result of stepping over memory boundaries you do not own. This is one of the most common forms of application crashes. Show us some code if you are having problems. And, as you point out, the C runtime library is not infallible. I've seen the source code of enough runtime libraries to know that there are some seriously deranged programmers out there. -- Thomas Hruska CubicleSoft President Ph: 517-803-4197 *NEW* VerifyMyPC 2.5 Change tracking and management tool. Reduce tech. support times from 2 hours to 5 minutes. http://www.CubicleSoft.com/VerifyMyPC/
