delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/08/15/14:30:11

Message-ID: <399987A3.141A6A49@ntlworld.com>
From: Steven Watson <steven DOT watson AT ntlworld DOT com>
X-Mailer: Mozilla 4.7 [en] (Win95; I)
X-Accept-Language: en
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
Subject: Re: newbie makelong?
References: <39985C49 DOT 3542BDAC AT ntlworld DOT com> <39986125 DOT 80837DE6 AT ntlworld DOT com> <nc0hps4fm0poukns0ipc59k7d6ssb8goog AT 4ax DOT com>
Lines: 49
Date: Tue, 15 Aug 2000 19:10:43 +0100
NNTP-Posting-Host: 62.254.78.169
X-Complaints-To: abuse AT net DOT ntl DOT com
X-Trace: news6-win.server.ntlworld.com 966363339 62.254.78.169 (Tue, 15 Aug 2000 19:15:39 BST)
NNTP-Posting-Date: Tue, 15 Aug 2000 19:15:39 BST
Organization: ntlworld News Service
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hi Damian,
Thanks for pointing out the non portability I dont have 
NT just win95 I will have to look for a portable way
the code comes from a Tutorial on C circular 1994, there is little 
error trapping being done you are quite correct to trap for memory
allocation
errors I do for Windows programming C and Oberon-2,just trying to make
sense of Dos.

Steven Watson


Damian Yerrick wrote:
> 
> On Mon, 14 Aug 2000 22:14:13 +0100, Steven Watson
> <steven DOT watson AT ntlworld DOT com> wrote:
> 
> >  #include <sys/nearptr.h>
> >  #include <crt0.h>
> >
> >  void * MK_FP (unsigned short seg, unsigned short ofs)
> >  {
> >    if ( !(_crt0_startup_flags & _CRT0_FLAG_NEARPTR) )
> >      if (!__djgpp_nearptr_enable ())
> >        return (void *)0;
> 
> On NT and in some other situations, this makes a null pointer.
> 
> >    return (void *) (seg*16 + ofs + __djgpp_conventional_base);
> >  }
> 
> And you don't trap for the null pointer.
> 
> >>         ptr = MK_FP(0xB800,offset);
> >>
> >>         while(*str)
> >>         {
> >>                 *ptr++= *str++;
> >>                 ptr++;
> 
> On NT, your program will crash.
> 
> --
> Damian Yerrick
> "I refuse to listen to those who refuse to listen to reason."
> See the whole sig: http://www.rose-hulman.edu/~yerricde/sig.html
> 
> This is McAfee VirusScan. Add these two lines to your signature to
> prevent the spread of signature viruses.  http://www.mcafee.com/

- Raw text -


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