Mail Archives: djgpp/1997/12/02/04:01:11
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 -