Mail Archives: djgpp/1998/01/28/11:16:03
On Wed, 28 Jan 1998 22:08:15 +0800 in comp.os.msdos.djgpp Liche
<liche AT tp DOT silkera DOT net> wrote:
: Does djgpp not support the far keyword? For example: char far* test =
: (char far*) 0x00000000L.
No. It doesn't need it in the same way that real-mode DOS compilers
do; you never need to allocate anything on the `far' heap since
there's so much memory available on the `near' heap. Under djgpp
there is no `far' heap at all.
The other use of far pointers in real-mode DOS is to access physical
memory locations directly, for hardware programming etc. This is
dirty, and while you can do it in djgpp it's a little more
complicated. You should have a look at section 18 of the FAQ for
information on how to do this.
In general, though, you can remove the word `far' throughout your
sources. If portability back to older compilers is a requirement, you
can just do something like this:
#ifdef __DJGPP__
#define far
#endif
to make the preprocessor remove them for you on djgpp compilations;
however you should also look at each use of `far' to check that
removing it is really going to work (i.e. what you're doing falls
under the first paragraph above). If backward portability is not an
issue, it's probably best to remove the `far' pseudokeyword by hand,
so that you do see them all and can decide whether or not it's
appropriate to just remove the word.
BTW, you shouldn't rely on (void *)0x00000000L being the value of a
null pointer -- #include <stdlib.h> and use NULL instead. Platforms
can have different values of a null pointer.
--
george DOT foot AT merton DOT oxford DOT ac DOT uk
- Raw text -