473,387 Members | 1,574 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

far and near?

Maybe this is a question,which is about far and near.

I remember that I learn far and near in real mode of X86,but seems
that they have the application in protect mode.Can anybody give me
some instances where the keyword of far and near is applied?

Many thanks.
Nov 14 '05 #1
7 2414
Stone Lan avait énoncé :
I remember that I learn far and near in real mode of X86,but seems
that they have the application in protect mode.Can anybody give me
some instances where the keyword of far and near is applied?


Dunno. These keywords doesn't belong to the C-language. You should ask
on a newsgroup dedicated to your platform.

--
Emmanuel

Nov 14 '05 #2
"Stone Lan" <st*********@hotmail.com> writes:
Maybe this is a question,which is about far and near.

I remember that I learn far and near in real mode of X86,but seems
that they have the application in protect mode.Can anybody give me
some instances where the keyword of far and near is applied?

Many thanks.


This is question 19.40d in the latest version of the C FAQ, but it
hasn't appeared in the HTML version yet.

19.40d: What are "near" and "far" pointers?

A: These days, they're pretty much obsolete; they're definitely
system-specific. If you really need to know, see a DOS- or
Windows-specific programming reference.

The C FAQ is at <http://www.eskimo.com/~scs/C-faq/faq.html>. You can
get a compressed copy of the latest plain text version at
<ftp://ftp.eskimo.com/u/s/scs/C-faq/faq.gz>.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Nov 14 '05 #3
Stone Lan wrote:

Maybe this is a question,which is about far and near.

I remember that I learn far and near in real mode of X86,but seems
that they have the application in protect mode.Can anybody give me
some instances where the keyword of far and near is applied?


Never. These keywords are pretty much obsolete.

They date back to the segmented memory models of the early
Intel 8088, 8086, 80286, 80386 chips and the then 16/32 bit
MS-DOS and Windows operating systems.

Since then the Intel chips have moved to full 32 and 64 bit
and Windows now uses a flat 32 bit memory model.

Jussi Jumppanen
Author of: Zeus for Windows (New version 3.93 out now)
"The C/C++, Cobol, Java, HTML, Python, PHP, Perl programmer's editor"
Home Page: http://www.zeusedit.com
Nov 14 '05 #4
"Stone Lan" <st*********@hotmail.com> wrote in message
news:cd**********@news.yaako.com...
Maybe this is a question,which is about far and near.

I remember that I learn far and near in real mode of X86,but seems
that they have the application in protect mode.Can anybody give me
some instances where the keyword of far and near is applied?

Many thanks.


Because modern OS' use flat memory model, these extensions are believed
to be obsoleted.

People tend to forget that even modern PC (IA32 platform) implements
and uses not only 32-bit (classic near) but also 48-bit pointers.
Even on Windows: certain OS data structures are addressed through
FS and GS selector registers.

Instances: embedded programming.

Roman
Nov 14 '05 #5
In <cd**********@news.yaako.com> "Stone Lan" <st*********@hotmail.com> writes:
Maybe this is a question,which is about far and near.
But you're not sure...
I remember that I learn far and near in real mode of X86,but seems
that they have the application in protect mode.Can anybody give me
some instances where the keyword of far and near is applied?


far and near are NOT and have NEVER been keywords of the C programming
language. They were merely extensions used by certain implementations
for the 16-bit members of the 80x86 family. The best newsgroup for
discussing them is, probably, comp.os.msdos.programmer.

However, if you're not interested in 16-bit programming on the 80x86,
you can safely forget everything you knew about them.

Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
Nov 14 '05 #6
Stone Lan wrote:
Maybe this is a question,which is about far and near.

I remember that I learn far and near in real mode of X86,but seems
that they have the application in protect mode.Can anybody give me
some instances where the keyword of far and near is applied?

Many thanks.

[Off-Topic]
The near pointer is a pointer that has a smaller range than
that of a far pointer. The far pointer required more memory
and instructions to use, but it could be used to access
a larger memory space.

The idea stems from relative and absolute addressing. In the
early days of 8 bit processors, processors would use 8-bit
signed values as offsets relative to the program counter
to designate addresses. Anything farther required 16 bits,
or two fetches. Thus acessing things closer was always
faster and required less code & memory.

For more information use your favorite internet search
engine with these keywords:
segmented architecture microprocessor
--
Thomas Matthews

C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.raos.demon.uk/acllc-c++/faq.html
Other sites:
http://www.josuttis.com -- C++ STL Library book

Nov 14 '05 #7
In <i5****************@newssvr32.news.prodigy.com> Thomas Matthews <Th****************************@sbcglobal.net> writes:
Stone Lan wrote:
Maybe this is a question,which is about far and near.

I remember that I learn far and near in real mode of X86,but seems
that they have the application in protect mode.Can anybody give me
some instances where the keyword of far and near is applied?
[Off-Topic]

The near pointer is a pointer that has a smaller range than
that of a far pointer. The far pointer required more memory
and instructions to use, but it could be used to access
a larger memory space.
Not only off-topic, but incorrect, too: both near and far pointers could
be used to access up to 64 KB of memory, they had exactly the same range,
because the segment part of a far pointer was fixed. To get pointer
arithmetic to work on all 32 bits of a pointer, you needed a huge pointer.
They were slower, but they didn't expose the programmer to the segmented
nature of the architecture: using a long index, you could scan the whole
address space of the machine in a purely linear manner (the compiler took
care of the dirty details).

The difference between a near pointer and a far pointer was that the
near pointer could cover the 64 KB of the default (code or data) segment
while the far pointer could cover 64 KB anywhere in the machine's address
space. Pointer comparisons between far pointers have always been a gray
area (I believe it was common to assume same segment and only examine the
offsets).
The idea stems from relative and absolute addressing. In the
early days of 8 bit processors, processors would use 8-bit
signed values as offsets relative to the program counter
to designate addresses. Anything farther required 16 bits,
or two fetches. Thus acessing things closer was always
faster and required less code & memory.


This is entirely unrelated to 8086 and near vs far pointers.

Please ignore any kind of questions, topical or not, when you have no
correct output to provide.

Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
Nov 14 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Marc | last post by:
I'm trying to execute a query in a postgresql database when the following message displays: State: S1000 Code: 7 Message: ERROR: parser: parse error at or near "." Regs. Marc Oost
4
by: rahul8143 | last post by:
hello, I require a single c++ program that will illustrate usage of this,far,near pointers. Can any body please explain me those pointers? regards, rahul.
39
by: Noticedtrends | last post by:
Can inference search-engines narrow-down the number of often irrelevant results, by using specific keywords; for the purpose of discerning emerging social & business trends? For example, if...
3
by: Quack Boy | last post by:
I'm new to MS Access (97) and I need for a query to find *near* matches (not exact duplicates) mainly to weed out duplicates that may contain similar erronious data. EG Table1 ...
5
by: r.nikhilk | last post by:
Hi, Currently, we are porting C++ applications from 32 bit to 64 bit on AIX platform. (The current version of AIX is 5.3 and xlC verison is 8.0). We are able to compile the applications by...
10
by: mkausalya | last post by:
hai experts can know about the use of far & near keywords in c lang
0
by: roamnet | last post by:
hi i created database file with .mdf extention ,sql server as a source and use grid view to display data there're no problem in data retrieve and display,but i want to edit it or insert new...
65
by: Aditya | last post by:
Hi I am using a line of as char recvedValues = {'\0'}; in my code. I get a warning as near initialization for recvedValues. I am using gcc 3.4 Can anybody please explain the meaning. Thanks...
11
by: xz | last post by:
In a program, if a double is within 0.0001 from an int, then I treat it as int. For example, 10.00005 will be treated as int, while 10.001 is not. I am looking for an algorithm to implement...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.