473,425 Members | 1,812 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,425 software developers and data experts.

about far & near keywords in c

hai experts can know about the use of far & near keywords in c lang

Feb 22 '07 #1
10 10709
mk*******@gmail.com wrote:
hai experts can know about the use of far & near keywords in c lang
There are no keywords called far and near in C as standardised by ISO.
They're implementation specific extensions.

<OT>
IIRC they're extensions in Turbo C for use under DOS's segmented
memory model, particularly with pointers. The so called 'near'
pointers are 16 bit and contain an offset address alone while the
'far' pointer is 32 bit and contains a full segment:offset address.
For more details, post to a Turbo C or DOS newsgroup.
</OT>

Feb 22 '07 #2
"santosh" wrote:
>mk*******@gmail.com wrote:
>...know about the use of far & near keywords in c lang

There are no keywords called far and near in C as standardised by ISO.
They're implementation specific extensions.

<OT>
IIRC they're extensions in Turbo C for use under DOS's segmented
memory model, particularly with pointers. The so called 'near'
pointers are 16 bit and contain an offset address alone while the
'far' pointer is 32 bit and contains a full segment:offset address.
For more details, post to a Turbo C or DOS newsgroup.
</OT>
[OT] The FAR/NEAR keywords were actually introduced by Microsoft, not
Borland, and they quickly spread to every C compiler for the
8086/Intel/DOS world.

Roberto Waltman

[ Please reply to the group,
return address is invalid ]
Feb 22 '07 #3
On Thu, 22 Feb 2007 09:16:38 -0500, Roberto Waltman
<us****@rwaltman.netwrote:
>"santosh" wrote:
>>mk*******@gmail.com wrote:
>>...know about the use of far & near keywords in c lang
There are no keywords called far and near in C as standardised by ISO.
They're implementation specific extensions.
<snip explanation of far/near by santosh>
>
[OT] The FAR/NEAR keywords were actually introduced by Microsoft, not
Borland, and they quickly spread to every C compiler for the
8086/Intel/DOS world.
<OT>
Well, 'far', 'near' and relatives (mainly 'huge' and 'tiny') are still
used by many cross compilers for microcontrollers. Some compilers use
__near or __far to comply with the ISO standard. Some don't.
</OT>

Have a nice day,
Pradeep
--
All opinions are mine and do not represent the views or
policies of my employer.
R Pradeep Chandran rpc AT pobox DOT com
Feb 22 '07 #4

"R Pradeep Chandran" <se*@sig.belowwrote in message >
<OT>
Well, 'far', 'near' and relatives (mainly 'huge' and 'tiny') are still
used by many cross compilers for microcontrollers. Some compilers use
__near or __far to comply with the ISO standard. Some don't.
</OT>
The huge and tiny memory models were a bit different.
To avoid having to mess about with far pointers, you could declare all
pointers to be far or near by default. There were even large and small
memory models as well.

The big advantage was you had to rewrite all the standrad library functions
to take far pointers. So you learnt how things were implemented.

Feb 22 '07 #5
Roberto Waltman wrote:
>
.... snip ...
>
[OT] The FAR/NEAR keywords were actually introduced by Microsoft,
not Borland, and they quickly spread to every C compiler for the
8086/Intel/DOS world.
Not so. As usual, Microsoft does not innovate. Those keywords
appeared with the assembly language for the 8088/8086, back around
1976. The amazing thing is that Microsoft actually used a
pre-existing standard. This may be tied in with the fact that they
bought their C compiler from somebody else (I forget who).

--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net>
Feb 23 '07 #6
On Thu, 22 Feb 2007 20:48:17 -0500, CBFalconer <cb********@yahoo.com>
wrote:
>Roberto Waltman wrote:
>>
... snip ...
>>
[OT] The FAR/NEAR keywords were actually introduced by Microsoft,
not Borland, and they quickly spread to every C compiler for the
8086/Intel/DOS world.

Not so. As usual, Microsoft does not innovate. Those keywords
appeared with the assembly language for the 8088/8086, back around
1976. The amazing thing is that Microsoft actually used a
pre-existing standard. This may be tied in with the fact that they
bought their C compiler from somebody else (I forget who).
I think it was Lattice.

http://en.wikipedia.org/wiki/Lattice_C

Regards
--
jay
http://www.microsoft.com/windows/pro...a/default.mspx
Feb 23 '07 #7
jaysome wrote:
>CBFalconer wrote:
>>Roberto Waltman wrote:
>>[OT] The FAR/NEAR keywords were actually introduced by Microsoft,

Not so. As usual, Microsoft does not innovate.
Those keywords
>>appeared with the assembly language for the 8088/8086, back around
1976.
Right, and Intel would have been the culprit here.

My comment was on the introduction of the far and near keywords as a C
language extension.
Based (from memory,) in reading an interview with somebody who was in
a management position for the DOS Microsoft C compilers.
He took pride in bringing far and near to the masses. (Can not recall
the person's name.)
>The amazing thing is that Microsoft actually used a
>>pre-existing standard. This may be tied in with the fact that they
bought their C compiler from somebody else (I forget who).

I think it was Lattice.

http://en.wikipedia.org/wiki/Lattice_C
Correct. The first C compilers sold under the Microsoft brand where
Lattice-C. (Not even repackaged.)

Roberto Waltman

[ Please reply to the group,
return address is invalid ]
Feb 23 '07 #8
On Thu, 22 Feb 2007 20:48:17 -0500, CBFalconer <cb********@yahoo.com>
wrote in comp.lang.c:
Roberto Waltman wrote:
... snip ...

[OT] The FAR/NEAR keywords were actually introduced by Microsoft,
not Borland, and they quickly spread to every C compiler for the
8086/Intel/DOS world.

Not so. As usual, Microsoft does not innovate. Those keywords
appeared with the assembly language for the 8088/8086, back around
1976. The amazing thing is that Microsoft actually used a
pre-existing standard. This may be tied in with the fact that they
bought their C compiler from somebody else (I forget who).
Sigh...

<off-topic trip down memory lane>

Microsoft's C compiler version prior to Version 3 were Lattice C
repackaged. Microsoft C 3.0 and later were their own in-house
compilers.

Neither Lattice nor Microsoft's pre version 3 compilers supported the
"near" or "far" extension keywords. Nor did they support the "tiny"
or "huge" memory models.

In fact, they did not support mixing pointer types or memory models.
Lattice came with four libraries, for the four possible combinations
of 16/32 bit code/data addressing. It was up to the user to link the
one matched the options passed to the compiler.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
Feb 24 '07 #9
Jack Klein wrote:
>
.... snip ...
>
<off-topic trip down memory lane>

Microsoft's C compiler version prior to Version 3 were Lattice C
repackaged. Microsoft C 3.0 and later were their own in-house
compilers.

Neither Lattice nor Microsoft's pre version 3 compilers supported
the "near" or "far" extension keywords. Nor did they support the
"tiny" or "huge" memory models.

In fact, they did not support mixing pointer types or memory
models. Lattice came with four libraries, for the four possible
combinations of 16/32 bit code/data addressing. It was up to the
user to link the one matched the options passed to the compiler.
Then how did the compiler know what kind of calling protocol to
generate? Did it have an anticipator function to read the
following link commands?

--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net>
Feb 24 '07 #10
CBFalconer wrote, On 24/02/07 09:46:
Jack Klein wrote:
... snip ...
><off-topic trip down memory lane>

Microsoft's C compiler version prior to Version 3 were Lattice C
repackaged. Microsoft C 3.0 and later were their own in-house
compilers.

Neither Lattice nor Microsoft's pre version 3 compilers supported
the "near" or "far" extension keywords. Nor did they support the
"tiny" or "huge" memory models.

In fact, they did not support mixing pointer types or memory
models. Lattice came with four libraries, for the four possible
combinations of 16/32 bit code/data addressing. It was up to the
user to link the one matched the options passed to the compiler.

Then how did the compiler know what kind of calling protocol to
generate? Did it have an anticipator function to read the
following link commands?
No, it has an option to tell it. If you told the compiler one thing but
the linker something else it all fell apart horribly.
--
Flash Gordon
Feb 24 '07 #11

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

Similar topics

4
by: el_bandido | last post by:
Hello, I've tried the FAQ and some minutes in googl'ing but was not happy with what I got. Basically I'd like to get a _simple_ example on how I could create a web based (portable across all...
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: Roop | last post by:
Hello all I need to understand the concepts of following terminology in C Language :-- Q1.. what is the near,far pointer mean's ? what is the difference between the these pointer and normal...
7
by: Edward Yang | last post by:
A few days ago I started a thread "I think C# is forcing us to write more (redundant) code" and got many replies (more than what I had expected). But after reading all the replies I think my...
2
by: dw | last post by:
Hi, everyone. I'm having difficulty understanding the difference of the keywords "friend" and "protected" vs. some of the other ways you can declare variables in ASP.NET ("dim", "public", and...
6
by: snt | last post by:
I have a C# asp.net project in which I create meta keywords dynamically. I have a problem with "&" character. When the page is rendered, the "&" character is converted into "&amp;". Is there any...
5
by: justobservant | last post by:
When more than one keyword is typed into a search-query, most of the search-results displayed indicate specified keywords scattered throughout an entire website of content i.e., this is shown as...
0
by: balean | last post by:
Hi guys, I need help. I am trying to extract data from XML file. I am using all the fucntions needed to parse the xml data every thing working fine, but what I am looking for is to take the string...
20
by: Aaron Gray | last post by:
There does not seem too be anyway to test if two jQuery references are the same element. Given :- ... <div id="1"></div .... Then :- alert( $("#1") == $("#1"))
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
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.