delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/07/09/13:31:52

Xref: news2.mv.net comp.os.msdos.djgpp:5782
From: Charles Sandmann <sandmann AT clio DOT rice DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Near pointers, are they bad?
Date: Tue, 09 Jul 1996 11:14:00 CDT
Organization: Rice University, Houston, Texas
Lines: 17
Message-ID: <31e28548.sandmann@clio.rice.edu>
References: <199607090524 DOT PAA24424 AT gbrmpa DOT gov DOT au>
Reply-To: sandmann AT clio DOT rice DOT edu
NNTP-Posting-Host: clio.rice.edu
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

> What I want to know is: Is this programming practice bad? I assumed that
> a near pointer in protected mode was the same as a far, ie: could access the
> full 4GB segment. It also seems to allow fast memory access...

It's not bad, it just has some disadvantages you need to be aware of.
Since you can access the entire 4Gb area, a bad pointer can trash DOS,
disk data buffers, interrupt tables, etc.  If you are running under Windows,
that means you can cause GPFs in other applications or trash windows itself.
Near pointers are also not supported on some DPMI providers (like Windows NT)
so your application will not run there.

It's a programming time vs safety/compatibility tradeoff.  If you have little
time, don't make mistakes, and don't plan to support this app on systems
without near pointer support, near pointers are the perfect tool.  If you
have a larger project with many programmers and modules, need to run it 
many places, then you probably should design using farptr.h (at least as
an option + the first cut).

- Raw text -


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