casts and puns (and digressions...)

Hugh Redelmeier hugh at hcrvax.UUCP
Wed Nov 14 04:27:54 AEST 1984


> > >Also, Pascal, which is doubtlessly a strongly typed language, does
> > >permit a type definition like 'type ref= ^ref;' and handles it
> > >correctly...

> Perhaps true, but marginally relevant to reality, since the only value
> assignable to an object of type ref is NIL.

This turns out not to be the case.  Type ref is a suitable representation
for integers.  If you remember Peano, here are some implementations:

constant zero = nil;
function successor(n: ref): ref; begin new(successor); successor^ := n end;
function predecessor(n: ref): ref; begin predecessor := n^ end



More information about the Comp.lang.c mailing list