[mod.compilers] Successful compilers for segment

compilers@ima.UUCP (01/07/86)

[from cej at IHNP4/PTSFA/WELL (Craig Jackson)]

You cannot produce a 'good' compiler for a segmented architecture for a
language that has unbridled pointers, such as C.  C comes with the built-in
assumption that addresses are mappable onto the integers.  Other languages
with this problem include PL/I and to a certain extent, FORTRAN.  On the
other hand, more disciplined languages such as Pascal have little trouble
being implemented on segmented architectures.  Witness UCSD Pascal: the
original implementation was done for the segmented architecture of a
Burroughs B6700.  The micro one came along because the mainframe was too slow.
-- 
Craig Jackson
UUCP: {ihnp4!linus,seismo!harvard}!axiom!mhis!dricej
      {dual,ptsfa,lll-crg,hplabs}!well!cej
BIX:  cjackson

[Good point, but if the mainframe was so slow perhaps they didn't deal
so well with segments after all.  In any event, Pascal as defined by J+W or
by ISO doesn't seem to me to be very good for doing things like mapping a
file into a segment and then doing useful things to it there.  PL/I at least
has area variables and offset pointers which are relative to areas.  -John]
--------

compilers@ima.UUCP (01/10/86)

[from Davidsen <harvard!rochester!steinmetz!davidsen>]

In article <136300020@ima.UUCP> compilers@ima.UUCP writes:
>....
>You cannot produce a 'good' compiler for a segmented architecture for a
>language that has unbridled pointers, such as C.  C comes with the built-in
>assumption that addresses are mappable onto the integers.

Not so! X3J11 has carefully stated that there is no guarantee that integers
can hold any pointer value, or that any pointer value except (void *) and
(char *) can hold the address of another data type without data loss. In K&R
(if you contend that X3J11 is not yet standard), there is an entire section
detailing that integers are not the same as pointers (see table of contents,
"Pointers are not Integers", pg 102).

Because the language allows the assignment, even though expressly defined to
be non-portable and posibly non-functional, some people assume that it must
work. This is about as valid a statement as saying that "FORTRAN assumes
division by zero is valid", because a divide by zero will compile. Please
clearly label your opinions as such, lest someone mistake them for facts.

[This is all true, but your moderator would appreciate some thought given
to languages that take advantage of segments, as opposed to those that can
be compiled to tolerate them.  C probably falls in the class of those that
just barely tolerate them, given that things like malloc() force you to
treat all data pointers as being in the same address space, even though they
may not have the same representation.  -John]

compilers@ima.UUCP (01/13/86)

[from ihnp4!ho95e!wcs]

In article <136300045@ima.UUCP> you write:
>[from Davidsen <harvard!rochester!steinmetz!davidsen>]
>In article <136300020@ima.UUCP> compilers@ima.UUCP writes:
>>....
>>You cannot produce a 'good' compiler for a segmented architecture for a
>>language that has unbridled pointers, such as C.  C comes with the built-in
>>assumption that addresses are mappable onto the integers.
>
>Not so! X3J11 has carefully stated that there is no guarantee that integers
>can hold any pointer value, or that any pointer value except (void *) and
>(char *) can hold the address of another data type without data loss. In K&R

I think you're misreading the original statement.  When the author wrote:
	"addresses are mappable onto the integers"
it could been talking about assigning pointers to ints, but was
probably talking about mapping the space of valid addresses onto the
mathematical set {1, 2, 3, 4, ...}, presumably 1:1 with a contiguous
subset of the integers - in other words, 
	"The memory of the machine looks like one long array, not
	 a bunch of little pieces"
which is untrue on segmented machines.
-- 
# Bill Stewart, AT&T Bell Labs 2G-202, Holmdel NJ
1-201-949-0705 ihnp4!ho95c!wcs
[I suspect that a piecewise continuous mapping would be sufficient.  In any
case, I'd rather drop this topic unless somebody from X3J11 or dmr has
something definitive to say.  -John]
--------