answersLogoWhite

0


Best Answer

Far pointers are generally used with 16 bit windows application. You can also use for DOS based application for accessing VDU memory since it has huge pointer and it can be fit into the far pointers.

Well, Win32 does not distinguish between near and far addresses. Because the types NEAR and FAR are defined in WINDEF.H, they are automatically handled by the include file, which redefines them as empty strings for Win32. Thus, NEAR and FAR are ignored. If you do not include WINDEF.H, a convenient solution is to use the /D command-line option to replace the keywords by empty strings. For example:

/D_near= /D_far= /D__near= /D__far=

The increased address-space size in 32-bit Windows impacts 16-bit code in several ways:

Pointers are all 32 bits wide and are no longer near or far, and your code cannot make assumptions based on segmented memory. Window handles, handles to other objects (such as pens, brushes, and menus), and graphics coordinates have increased to 32 bits. Thus, you cannot use types such as WORD interchangeably with HWND as you could in 16-bit Windows. Message handlers must be rewritten because the different sizes can change the way information is packed in some message parameters. The larger size of graphics coordinates affects a number of function calls. The key areas of 16-bit code affected by these changes are:

Window procedure declarations, Near and far type declarations, Data types, Messages, Calls to API functions, WinMain function

User Avatar

Wiki User

7y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

13y ago

far pointer can access memory that is larger than 64kb, sometimes, such as when dealing with

video memory, a needful thing.

Hello, it's 2011 now -- use a 32-bit compiler and forget about 16-bit DOS systems like TurboC. (But if you absolutely have to use TurboC, use Large model (or Huge), and forget about near and far).

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: In which cases should you use the far pointers?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

How to declare near and far pointers in C?

It used to be a good question 30 years ago. Right know you don't have to know anything about near and far pointers; but if you still use a 16-bit compiler, select 'Large Model' (or 'Huge Model'), and forget 'near' and 'far'


What do you use to supplement your current testing methods with the ability to flag memory leaks and unassigned pointers you use?

I have no need to flag memory leaks or unassigned pointers because I eliminate all leaks at source by using resource handles, smart pointers and making proper use of RAII.


In C you use the concept of pointers whereas there are no pointers used in JAVA why?

Pointers in C are generally the thing that gives learners the most trouble. When C code is not written correctly with respect to pointer use, the resulting bugs can often be very difficult to find and correct. On the other hand, pointers are absolutely necessary in some cases.The designers of Java wanted to make programming easier and hence avoided adding pointers to the language. Java does have object references which accomplish much of what pointers accomplish albeit in a safer way.


Why are they no pointers in java?

Pointers are a crucial feature of several programming languages, including C and C++, that allow direct manipulation of memory addresses. Pointers are used to create dynamic data structures, access memory directly, and create efficient algorithms. However, pointers are not available in the Java programming language. In this article, we will explore why pointers are not present in Java and the advantages and disadvantages of this decision. The main reason why pointers are not present in Java is security. Pointers allow direct access to memory addresses, which can be used to manipulate memory in unexpected ways. In Java, memory is managed automatically by the Java Virtual Machine (JVM), which helps to prevent accidental or intentional manipulation of memory. This is important for security, as malicious code could use pointers to gain unauthorized access to sensitive data or systems. By removing pointers, Java ensures that all memory access is controlled and managed, which helps to prevent security threats. Another reason why pointers are not present in Java is the ease of use. Pointers are a complex feature that can be difficult for beginner programmers to understand and use effectively. Java was designed to be an easy-to-use programming language, and by removing pointers, Java makes it easier for beginners to write correct, secure code. Java also makes it easier for programmers to write portable code, as the absence of pointers ensures that code written in Java will work on any device that supports the Java Virtual Machine. However, the absence of pointers in Java also has some disadvantages. One of the main disadvantages is that Java can be slower than languages that support pointers, as the automatic memory management provided by the JVM can be less efficient than direct memory manipulation. When handling large amounts of data, the JVM may not be able to allocate memory as efficiently as a programmer working directly with pointers. When working with pointers, a programmer has complete control over the memory allocation and can optimize it for their specific use case. Another disadvantage of the absence of pointers in Java is that some algorithms and data structures cannot be implemented as efficiently as they can be in languages that support pointers. For example, binary trees can and linked lists and are implemented more efficiently in C or C++, as they can use pointers to link nodes together in memory. Java must use other techniques, such as object references, to implement these structures, which can result in slower and less efficient code. In conclusion, the absence of pointers in Java was a deliberate decision made to improve the security and ease of use of the language. This decision has both advantages and disadvantages, as Java is easier to use and more secure, but it can be slower and less flexible than languages that support pointers. Nevertheless, the popularity of Java and its widespread use in industry and academia demonstrate that the benefits of the absence of pointers outweigh the drawbacks.


Is Use of pointers in function saves the memory space?

No. But avoiding unnecessary duplication of data does.

Related questions

How to declare near and far pointers in C?

It used to be a good question 30 years ago. Right know you don't have to know anything about near and far pointers; but if you still use a 16-bit compiler, select 'Large Model' (or 'Huge Model'), and forget 'near' and 'far'


What settings do you need to use far keywords and other c style syntax in our programs while writing programs in VC?

There are no settings. Near and far pointers are specific to segmented memory models but when working with virtual memory models we always use normalised pointers which are always the same length (in bits). Near pointers use fewer bits than normalised pointers (usually half as many bits) because they only refer to the offset address within the current segment. Far pointers are similar to normalised pointers, except the high-order word refers to the segment address and the low-order word refers to the offset within that segment.


Can you use pointers in java?

Java does not support Pointers and hence you cannot use it in Java.


Do you use pointers in java?

no


Can char pointer contain long address in c?

What do you mean by 'long address'?1. If you are asking about 'near' and 'far' pointers, then you should forget them; simply use Huge Memory Model.2. If you mean the address of a 'long int'-type variable, then yes, with type-cast:long l;char *p = (char *)&l;Note: for generic pointers you can use type void *


Why to use pointers in programs?

To use memory effectively. . .


What are five safety pointers for use in electronic shop work?

safety pointers in electric shop


Pointers are include in csharp or not?

Yes, you can use pointers in the C#, but to some extent. Links are added with more details.


What kind of drills do you use for three pointers two pointers and foul shots?

just keep shooting its not that hard


Why laser mouse are used?

Because the laser pointers are much easier to use than the ball pointers. The ball pointers are often difficult to move around while the laser pointers can move in any direction without "getting stuck"


What you use in case of pointer in java?

Java does not have pointers


Where should you use far and few?

Use it a few times in far away places.