From: "John M. Aldrich" Newsgroups: comp.os.msdos.djgpp Subject: Re: Debuging Date: Tue, 02 Dec 1997 23:59:32 +0000 Organization: Two pounds of chaos and a pinch of salt Lines: 30 Message-ID: <3484A0E4.4DAA@cs.com> References: Reply-To: fighteer AT cs DOT com NNTP-Posting-Host: ppp217.cs.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Andrew Deren wrote: > > Thanks, but someone pointed before that the problem was with constructors > of the classes. I had some global instacnes of some classes where some > fields where initialized to null and they were calling text_length to > calculate something, in win95 dpmi host it's fine to do that but not in > cwsdpmi. So I just changed the allegro text_length functions and put: > if (!text) return 0; > and the program works fine now. I should probably point out that in Win95's DPMI host, it's not "fine" to dereference NULL pointers, it's just not caught by the host. Instead of dying with a segmentation violation, your program goes merrily on to read from or write to the invalid address, often corrupting your program's code segment or other vital information. CWSDPMI _catches_ this violation, preventing your program from eating itself at the cost of a crash. In my very humble opinion, the latter behavior is preferable, in addition to making programs a lot easier to debug! :) -- John M. Aldrich * Anything that happens, happens. * Anything that, in happening, causes something else to happen, causes something else to happen. * Anything that, in happening, causes itself to happen again, happens again. * It doesn't necessarily do it in chronological order, though. --- Douglas Adams