www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/06/27/19:45:21

From: Sinan_Unur AT mail DOT com (A. Sinan Unur)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: They do NOT run the same! W95/DOS!
Date: 27 Jun 2000 23:31:49 GMT
Organization: Cornell University
Lines: 58
Sender: verified_for_usenet AT cornell DOT edu (asu1 on pppa33-resaleithaca2-4r7311.saturn.bbn.com)
Message-ID: <8F60CED96ASINANUNUR@132.236.56.8>
References: <s97hls8hlhbikfhjkaut11p3lavr480eq2 AT 4ax DOT com> <gvvhls8pqkvcavrc6odvj2ud1mnuuj553h AT 4ax DOT com> <8F60AAC2BASINANUNUR AT 132 DOT 236 DOT 56 DOT 8> <rt6ils4mql8imek537fpr0acsgkheqplbh AT 4ax DOT com>
NNTP-Posting-Host: pppa33-resaleithaca2-4r7311.saturn.bbn.com
X-Trace: news01.cit.cornell.edu 962148709 10844 4.48.183.94 (27 Jun 2000 23:31:49 GMT)
X-Complaints-To: usenet AT news01 DOT cit DOT cornell DOT edu
NNTP-Posting-Date: 27 Jun 2000 23:31:49 GMT
User-Agent: Xnews/03.04.11
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

radsmail AT juno DOT com (Radical NetSurfer) wrote in 
<rt6ils4mql8imek537fpr0acsgkheqplbh AT 4ax DOT com>:

>Thank you, kind Sir.
>
>My understanding was that once a pointer is set to NULL,
>AFTER "destroying" it, I may RE-ASSIGN (this is the crucial part you
>see) THAT SAME POINTER once again to the 
>Another NEWLY created object OF THE SAME TYPE...

of course. but you should not dereference the pointer before it again points 
to valid storage. this is where i am guessing you have a problem.

of course, it is hard to give any more information because you do not show any 
code that exhibits your problem.

>PS: I have discovered that my program runs more successfully
>      within a Windows 3.11 (yes! MANY people ARE still using Win3.11)
>      and that delighted me to see that work!

win 3.x dpmi server suffers from the same problem (not catching accesses to 
invalid storage) as the win 9x server.

just yelling at people instead of trying to find your mistake is not going to 
make you a better programmer.

do try the following:

>>for further enlightenment, you can test the following program under dos 
>>and in a dos window under windows 9x.
>>
>>#include <stdlib.h>
>>
>>int main(void) {
>>    char* nullpointer = NULL;
>>    *nullpointer = 'c';
>>    return 0;
>>}

you'll see that the program runs 'perfectly' (by your definition) under 
windows, and crashes with a SIGSEGV in dos. this way you can track down places 
in your program where you are writing to memory areas which you shouldn't 
write to.

also check out the 'weird problems' section of the comp.lang.c FAQ, in 
particular: 

http://www.eskimo.com/~scs/C-faq/q16.5.html
http://www.eskimo.com/~scs/C-faq/q16.8.html

if you want more help, you need to provide an example of code that exhibits 
your problem.

Sinan.
-- 
--------------------------------
A. Sinan Unur
http://www.unur.com/

- Raw text -


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