From: "John M. Aldrich" Newsgroups: comp.os.msdos.djgpp Subject: Re: Try this one on for size Date: Wed, 16 Apr 1997 06:05:37 +0000 Organization: Two pounds of chaos and a pinch of salt Lines: 34 Message-ID: <33546C31.6872@NO.SPAM.cs.com> References: <199704162029 DOT QAA02720 AT hcst DOT net> NNTP-Posting-Host: ppp102.cs.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk 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 | ---------------------------------------------------------------------