Different pointer representations on the same machine

RAMontante bobmon at iuvax.cs.indiana.edu
Fri Feb 17 14:45:04 AEST 1989


(Apologies to flat-address_space fans and C purists...)

[ Wade Guthrie asks for examples of computers using different
representations for different pointer types.  Then... ]

gregg at ihlpb.ATT.COM (Wonderly) <9626 at ihlpb.ATT.COM> :
-The middle model of the typical 80x86 C compiler is a great example.
-Typically, pointers to text are FAR (selector/segment plus offset) while
-pointers to data are NEAR (just offset).  While there is not a model
-(that I have seen) that is the other way, it is a conceivable alternative.

As a matter of fact, the "conceivable alternative" (called Compact in
TC), is the one that makes sense to me.  Most of the interesting
programs I write need less than 64K of text to massage a couple hundred
kilobytes of arrays (all the array I can fit into memory).  I've never
even used the medium model.

The oft-maligned NEAR/FAR keywords in the MSC and TC compilers exist to
facilitate linking modules that are compiled in different models -- this
is a case of having to cope with different representations for the
_same_ types of pointers.  (Although prototyping avoids some goofups, and
the rest usually -- not always -- turn up as linker errors.)
--
"Aren't you sorry you didn't hit 'n'?"



More information about the Comp.lang.c mailing list