Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!zaphod.mps.ohio-state.edu!rpi!bu.edu!inmet!draper From: draper@inmet.inmet.com Newsgroups: comp.lang.c Subject: Re: Null Pointer Assignment Message-ID: <20900010@inmet> Date: 16 Oct 90 16:47:00 GMT References: <15004@mentor.cc.purdue.edu> Lines: 50 Nf-ID: #R:mentor.cc.purdue.edu:15004:inmet:20900010:000:1818 Nf-From: inmet.inmet.com!draper Oct 16 12:47:00 1990 /* Written 9:53 am Oct 13, 1990 by darcy@druid.uucp in inmet:comp.lang.c */ In <27154927-274.1comp.lang.c-1@tronsbox.xei.com> Bill Cavanaugh writes: >>>not come up until the end of the program. In fact, I put in the line >>> >>>printf("done\n"); >>>exit(0); >>> >>>at the end of my main, and when executed, it says >>> >>>done >>>Null Pointer Assignment >>> >>>Does this make sense? Thanks for any suggestions. >>> >>I'm not sure about the message, so I won't comment on that, but the reason >>the message is coming up after the printf() is that the printf() sends it's >>output to stdout, and the message is going to stderr.... >> >Wrong. The Null Pointer Assignment message is generated *AFTER* main returns. >The C startup code looks at the copyright message at address 0 to see if it >was modified anytime during the run. This is necessary on DOS systems as >there is no memory protection to generate an exception. This check at the >end of the program is designed to give some indication that a NULL pointer >was dereferenced. The error however could have happened anywhere in the >program. To find it you have to use your debugger to follow the values >at DS:0 or set a watch up for that memory location. Check your debugger >documentation for details. /* End of text from inmet:comp.lang.c */ When I first started programming in C using MSC 4.0 I ran into this message on several occasions. I traced it down to some sloppy code and coding techniques used to parse command line arguments. If you are using argc,argv in your code that is where I would start looking. - Dave Draper It's not a bug ... it's a feature. Internet: draper@inmet.inmet.com UUNET: uunet!inmet!draper ----- Intermetrics Microsystems Software, Incorporated 733 Concord Avenue Cambridge, MA 02138 (617) 661-0072 x4573