Mail Archives: djgpp/1997/04/16/20:36:16
Bryan Murphy wrote:
>
> Ok, here's something weird... I have a program that heavily uses pointers.
>
> However, I've thoroughly checked my pointer routines, and to the best of
> my knowledge, they appear to be working properly.
>
> If I run the program in Dos, I get a SigSegV right away after running the
> program and it draws the screen.
This symptom is virtually guaranteed to be a NULL pointer dereference of
some kind. CWSDPMI, which runs in DOS, catches NULL pointer
dereferences, but the Windows DPMI host lets them by without comment,
and thus after a few such dereferences you can really screw up your
program. As to why it's working in a full screen and not in a window, I
have no idea.
I know from long experience that invalid pointers can be one of the
hardest bugs to find. Many moons ago, I agonized over an apparent
memory bug in one of my programs, and eventually gave up. I realize now
that what I probably did was allocate memory improperly. Imagine the
following:
struct big_bad_struct *x;
x = malloc( sizeof(x) );
I leave it up to you to determine why this is wrong. ;)
--
---------------------------------------------------------------------
| John M. Aldrich, aka Fighteer I | mailto:fighteer AT cs DOT com |
| Proud owner of what might one | http://www.cs.com/fighteer |
| day be a spectacular MUD... | Plan: To make Bill Gates suffer |
---------------------------------------------------------------------
- Raw text -