Thirty year old code almost still compiles (and does still work!)

Thirty years ago, in February of 1987, I published some code of mine on net.sources:

 

 

 

 

 

 

 

 

There is so much deliciousness in this old post, including evidence that my affinity for the word “actually” goes a long way back.

Because I was a hardcore Amiga nerd back then (as opposed to simply now being an all-around hardcore nerd), I also submitted the program for inclusion in the “Fred Fish Amiga Source Disks” that he (Fred Fish) used to curate. It was included on disk #66 and still available as “MallocTest” online here:

ftp://ftp.funet.fi//.m/pub/amiga/fish/001-100/ff066

For reasons surpassing understanding, I decided to download that code, unpack the archive (that itself took some research), and see if it still compiles and works.

IT DOES!

Well, almost. It generated over 40 warnings on my Mac, mostly related to modern declarations of C library functions vs the mismatched (if even present at all) declarations in the code.

It did generate one fatal error – one of my functions does not return a value but is not declared void. I’m pretty sure that’s because the “void” type wasn’t universal back then, and in any case it was common practice to just fall out the bottom of what were implicitly void functions (that had been implicitly declared as “int”).

So, I had to fix that to get it to compile; here’s the diff that made the thirty-year old compile:

29a30,33
> void add_to_events (struct memevent *);
234c238
< add_to_events (m)
---
> void add_to_events (m)

With that change, it still compiles and works! The code itself is a time capsule of everything that was wrong with software development back in the late 80’s, including most importantly the fact that the malloc/free library on a given machine might have a bug in it that this feeble test could uncover (which, apparently, it did, though I have since forgotten which platform I was researching malloc/free problems on at the time).

Presented, for your amusement: https://github.com/outofmbufs/MallocTest1987

 


Comments

2 responses to “Thirty year old code almost still compiles (and does still work!)”

  1. This reveals a lot about how much the scale of things has changed in thirty years. I have another program that was used to test virtual memory systems (from my days of doing a 4.2BSD Unix port). The program allocates a “huge” 1MB array and accesses it randomly, with the intent of causing virtual memory paging I/O. I would run a few copies of that program to thrash test systems back in the day. Today my (rather old) laptop could run just about 2000 copies of that program before using up its physical RAM.

    Like

  2. […] by finding some thirty-year-old code of mine online, I wondered if there were any even older references… and I found […]

    Like

Leave a comment