[comp.lang.c] A question about Turbo C 2.00

eager@ringworld.Eng.Sun.COM (Michael J. Eager) (05/03/90)

In article <8850@hubcap.clemson.edu> wkay@hubcap.clemson.edu (W. Kevin Kay) writes:
>This is a question concerning a problem that I am having with Turbo C
>Version 2.00 and I hope to get corrected.
>
>I am writing a piece of software and can successfully compile the thing
>within the interactive environment, and the executable file works just
>fine; however, I have also created a "makefile" for the software and
>I run into problems when I compile with this mechanism.
>
>The proper files seem to compile and link just fine, and when I run the
>executable file, it appears to execute OK; however, when I terminate the
>program, I get the message "null pointer assignment" at termination.  This
>does NOT show up on the exectable file produced by the interactive
>environment.
>
>As part of my procedure during the creation of my makefile, I used the 
>"tcconfig" utility to create the file "turboc.cfg" for use by the command
>line compiler.  Supposedly, this sets up the compiler in the same
>configuration as that used in the interactive environment.  Throughout this
>project I have used the medium memory model.
>
>Does anyone out there have any ideas as to why this error msg is showing up
>one place, but not the other?  Is this a common problem?  I would appreciate
>any help concerning this matter.  Please e-mail responses to
>
>wkay@hubcap.clemson.edu
>
>thanks ahead of time,
>Kevin Kay

Most likely, you are dereferencing a null pointer.  When you use a pointer
which has not been initialized, you most likely will store data in the 
first several bytes of the segment.  TC amd MSC both check to see if the
data there has been modified when the program exits.  They issue the
"null pointer assigment" message to let you know that this is happening.
Your guess where it happens.

The difference between the executable created in the interactive environment
and the batch version possibly has to do with the initialization of auto
variables.  If the uninitialize pointer being used is auto, and happens to
have a small value in one environment and a large value in another, different
results may occur.

-- Mike Eager