www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/12/29/06:31:17

Date: Mon, 29 Dec 1997 13:30:53 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: "S. M. Halloran" <mitch AT duzen DOT com DOT tr>
cc: djgpp AT delorie DOT com
Subject: Re: Winsock.h parse error problem
In-Reply-To: <199712290950.LAA00203@ankara.duzen.com.tr>
Message-ID: <Pine.SUN.3.91.971229132234.28272B-100000@is>
MIME-Version: 1.0

On Mon, 29 Dec 1997, S. M. Halloran wrote:

> FAR and NEAR and other "fundamental classes of data types" like this 
> are inventions necessary for the "real mode" segment-offset 
> addressing architecture of the Intel x86 chips.  Intel eliminates 
> this craziness with the 80386 chips and those that follow.  Intel 
> must retain this crazy way of memory addressing, of course, so that 
> older programs compiled can run, but with the 386 and beyond, Intel 
> goes to the "flat model" (and common sense) way of memory addressing.

This is a very common misconception.  NEAR and FAR are here because of 
the segmented architecture of the Intel chips, more precisely, of their 
way to access memory.  This segmentation does NOT go away in 386 and 
better processors, nor is it eliminated in protected-mode programs.  What 
does happen is that you get a huge (2GB-long) data segment, so using only 
NEAR pointers you have a very large address space.  Think of it as if you 
were programming in the real-mode small memory model: would you say that 
the segments are ``gone'' for small model also?

I don't know enough about RSXNT (to which the originator of this thread 
referred), but NEAR, FAR and PASCAL could be used there for a purpose.  
In protected-mode programming, far pointers are used to access parts of 
memory which aren't mapped into your data segment, such as memory-mapped 
devices and some 16-bit layers of the Windows address space.

- Raw text -


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