Mail Archives: djgpp/1996/01/10/15:34:40
> >Segment violation in pointer 0x00000000 at d8:de81
> >
> >It works fine compiled with TC... Is this error sent by a particular bug
> >en DJGPP or by some 'TC supported' functions or syntax that GCC handles
> >badly? Thanx
>
> You're looking for a bug in the wrong place. The bug isn't in djgpp,
> the bug is in your program. At some point in your program you are
> dereferencing a NULL pointer. Turbo C didn't catch the bug because
> there is no memory protection in real mode. Turbo C will let you smash
> the interrupt table with reckless abandon.
>
> The easiest way to find the bug is to use the debugger. It should be
> able to tell you where the error happened.
>
> Eric
Well actually I doubt i'd trash the interrupt table since we don't assing
anything to it at the beginning, therefor, I guess, it points to *nowhere*
or *anywhere*. The problem we found (after hours of debugging!) is that
TC handles NULL pointers by returning a NULL value when comparing
pointers (ie if(my_pointer) my_pointer[x] = z;) that is, if my pointer is
initialised, give it a value. Else initialize it. Anyway we remade all
the program remodeling the pointer uses and now it works fine with TC and
GCC! (actually much better in GCC ;) ) Thanx all!
Hmm btw, how can we test if a pointer is NULL?!
- Raw text -