Path: utzoo!censor!geac!torsqnt!lethe!yunexus!ists!helios.physics.utoronto.ca!news-server.csri.toronto.edu!cs.utexas.edu!usc!elroy.jpl.nasa.gov!ncar!noao!arizona!dave From: dave@cs.arizona.edu (Dave P. Schaumann) Newsgroups: comp.sys.amiga.programmer Subject: Re: Good Programming stops guru |||| and BNF of C++ Message-ID: <629@caslon.cs.arizona.edu> Date: 9 Jan 91 14:13:13 GMT References: <1806@winnie.fit.edu> Organization: U of Arizona CS Dept, Tucson Lines: 18 In article <1806@winnie.fit.edu> rcs91900@zach.fit.edu ( Charles Stockman /ADVISOR-Clutterham) writes: >First of all I wanted to thank everyone who answered my question about how >I could descrease the number of times the guru appeared. However, I would >like to continue this discussion, so could someone tell me how to do safe >coding (coding that protects you from the guru). One thing you certainly want to watch is how you use memory you get from malloc. I recently had a bug where I said 'malloc(foo)', when I really wanted 'malloc(foo * sizeof(int)'. Naturally, in the first version, subsequent code stomped all over the memory past the allocated block. Unfortunately, this contained information vital to the integrety of the free memory list. The result of this is at some time later (usually shortly after my program quit) my Amiga would crash and burn. Usually with the 'memory freed twice' guru. Dave Schaumann | My folks went to uunet.uu.net, but all dave@cs.arizona.edu | they got me was this lousy .sig...