www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/01/10/15:34:40

Date: Wed, 10 Jan 1996 14:53:28 -0500 (EST)
From: dunder <dunder AT nyongwa DOT montreal DOT qc DOT ca>
To: "Eric J. Korpela" <korpela AT islay DOT ssl DOT berkeley DOT edu>
cc: djgpp AT delorie DOT com
Subject: Re: (none)
Message-ID: <Pine.LNX.3.91.960110145226.9577B-100000@noether.nyongwa.montreal.qc.ca>
MIME-Version: 1.0


> >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 -


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