[fpc-devel] Free Pascal 2.4.2 minimal distros for fpGUI available

Paul Breneman Paul2006 at BrenemanLabs.com
Thu Nov 18 04:15:46 CET 2010


Michael Schnell wrote:
> On 11/16/2010 02:52 PM, Paul Breneman wrote:
>>
>>
>> I try hard to write Pascal programs without using pointers and without 
>> allocating or deallocating memory. 
> 
> OOpps. How is this possible :) ?  But in what way does this help on that 
> issue ? I do see that memory allocation/deallocation is a source to very 
> hard to find bugs, but avoiding it makes may things close to impossible.

I don't doubt that there are certain domains where application-level 
memory allocation/deallocation is very necessary.  But for the type of 
programs I usually write it isn't.  I've written a lot of machine 
control projects with TurboPascal starting in 1985.  The only strings 
(short) at that time were still long enough for the serial data buffers 
I needed.

In 1985 I started working on an existing real-time video editing program 
written in PDP-11 assembler.  In the early 90s I ported that to pure 
TurboPascal (no assembler) with ~50,000 source lines.  The only 
interrupts were for the keyboard and also a video timing interrupt (50 
or 60 Hz) and about one-third of the code lived in the timing interrupt 
routine.  One system had 24 RS-422 serial ports (38,400 baud) in an 
inexpensive RadioShack Tandy 386 computer, which was the main computer 
that controlled about $2 million of digital video editing equipment. 
Quite a funny picture in a way (a peasant running a rich kingdom)...

Several fellows who developed such PC-based editors before me had to use 
expensive and complex intelligent multi-port serial port cards but 
thankfully I waited just long enough that the 16550 UART (with the 16 
byte FIFO) had arrived on the scene so my system was much simpler.  All 
of the commands (during the real-time recording) were 16 bytes or less 
so using 16550 UARTS it all worked without interrupts for the serial ports.

I just went back and searched the ~50,000 likes of source, and there is 
not a single New/Dispose (nor Mark/Release) in all of my code.  My 
program never crashed (even at the beginning beta stage) and I never 
used a debugger but rather a little logging when needed.

All video editing is now done with fast computers but here is a freeware 
version of that program that can utilize 9 serial ports:
   http://www.brenemanlabs.com/MachOne5.htm
   http://www.brenemanlabs.com/Mach1I.htm

One of my favorite authors (Jack Crenshaw) likes TurboPascal a lot, and 
(if I remember right) years ago he wrote something along the lines of: 
When I compile a C program I'm surprised if it runs the first time, but 
when I compile a TurboPascal program I'm surprised if it doesn't run the 
first time.




More information about the fpc-devel mailing list