[ILUG-BOM] Buggy C prog

Tahir Hashmi code_martial@[EMAIL-PROTECTED]
Fri Sep 27 11:09:26 IST 2002


> My guess is it's purely coincidental that your code worked on DOS.

Mustn't be much of a coincidence. Once I wrote a struct for a matrix
of doubles that was initialized on input from a file and it used
dynamic memory allocation.

I went on to make a heavy-duty Gauss-Jordan solver out of it and
tested it with the given equations (it was an assignment in college).
The program ran perfectly except for a memory access violation at the
very end of execution after all the results had been obtained. 

Turned out that I forgot to allocate memory for _any_goddamed_thing_!
(That was supposed to be just one malloc()).

The compiler? TurboC++. (Don't ask me what _I_ was doing with TC++ :D)

-- 
Tahir Hashmi (VSE, NCST)
http://staff.ncst.ernet.in/tahir
tahir AT ncst DOT ernet DOT in

We, the rest of humanity, wish GNU luck and Godspeed





More information about the Linuxers mailing list