Path: utzoo!news-server.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!snorkelwacker.mit.edu!bloom-beacon!eru!kth.se!cyklop.nada.kth.se!news From: d88-jwa@dront.nada.kth.se (Jon W{tte) Newsgroups: comp.sys.mac.programmer Subject: Re: Think C Agony! Message-ID: <1991Mar7.163853.28307@nada.kth.se> Date: 7 Mar 91 16:38:53 GMT References: <1991Mar7.063549.14081@dartvax.dartmouth.edu> Sender: news@nada.kth.se (Mr News) Organization: Royal Institute of Technology, Stockholm, Sweden Lines: 31 In-reply-to: sean@eleazar.dartmouth.edu's message of 7 Mar 91 06:35:49 GMT /* allocate bias matrix */ if (!((**hclusterNew).prgbiasstruct = (BIASSTRUCT**) NewHandle(NumNodes * sizeof(BIASSTRUCT)))) ~~~~~~~~~ Be careful ! NewHandle moves memory, and you have a dereferenced handle in **hclusterNew. In THINK C, this gets evaluated after the function call, but not in all C compilers (I believe)... { DisposHandle(hclusterNew); return(FALSE); } (**hclusterNew).LearningRate = (**network).DefaultBiasLearningRate; So what's "network" anyway ? It's hard to debug without knowing how stuff is declared... By the way, things that crash when run normally but don't when run in the debugger usually don't initialize all the managers in the right way. (Check InitGraf, InitFonts, InitMenus, InitWindows, InitDialogs, TEInit for starters...) h+@nada.kth.se Jon W{tte "The IM-IV file manager chapter documents zillions of calls, all of which seem to do almost the same thing and none of which seem to do what I want them to do." -- Juri Munkki in comp.sys.mac.programmer