delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/12/02/04:01:11

From: "John M. Aldrich" <fighteer AT cs DOT com>
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: <Pine DOT SUN DOT 3 DOT 95 DOT 971201183547 DOT 26529D-100000 AT ernie DOT eecs DOT uic DOT edu>
Reply-To: fighteer AT cs DOT com
NNTP-Posting-Host: ppp217.cs.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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 <fighteer AT cs DOT com>                      

* 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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019