[fpc-other] Stanford Pascal Compiler successfully ported to Windows, OS/2 and Linux

Mark Morgan Lloyd markMLl.fpc-other at telemetry.co.uk
Tue Dec 27 10:08:20 CET 2016


On 26/12/16 19:00, Bernd Oppolzer wrote:

A thought without its being a direct comment on any part of what you've 
written. Programming texts from Wirth onwards tended to muddle pointers 
and dynamic memory allocation together, so in effect assumed that 
pointers would /only/ come out of the heap manager hence could be 
checked for consistency in that context. Early Pascal compilers neither 
had an addressof() function nor expected that the underlying OS would 
return a pointer as a syscall result.

When teaching/supporting I've found it useful to make the opposite 
assumption, i.e. starting off with a hypothetical OS call that returned 
a pointer and showing students what they could do with it, and only 
later introducing trees etc. on the heap.

Apart from that, I've certainly seen mark/release being the dominant 
mechanism in 1980s compilers, and even Turbo Pascal 3.0 (circa 1986) 
supports it with the explicit

"NOTICE that Dispose and Mark/Release use entirely different approaches 
to heap management - and never shall the twain meet! Any one program 
must use either Dispose or Mark/Release to manage the heap. Mixing them 
will produce unpredictable results."

Turbo Pascal 5.0 (circa 1989, and not long preceding Delphi) appears to 
adopt a complex scheme to handle both of the approaches, and observes

"Mark and Release cannot be used interchangeably with Dispose and 
FreeMem unless certain rules are observed [...] ."

-- 
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]


More information about the fpc-other mailing list