C (was: The iAPX 432 and block languages)

Sean Conner spc at conman.org
Tue Apr 11 18:37:29 CDT 2017

It was thus said that the Great Jecel Assumpcao Jr. via cctalk once stated:
> Sean Conner wrote two great posts on Mon, 10 Apr 2017 21:43:29 -0400
> These are all very good points. I agree I was exagerating by saying the
> iAPX432 and 8086 couldn't run C. After all, the language was born on the
> PDP-11 and that was limited to either 64KB or 128KB. So any C programs
> for that machine could be trivially recompiled to run on either Intel
> processor. But I certainly wouldn't want to port the C version of Spice
> to DOS, for example (I was given the job of porting the Fortran version
> of Spice from the PDP-11 to the Burroughs B6900 and can tell you that
> tales of Fortran's compatiblity are greatly exagerated, but that is
> another story).

  I can relate.  I have the code to Viola [1] and it no longer compiles
cleanly [2].  I have cleaned up the code enough to get it to produce an
executable, but man ... the code ... it *barely* runs on a 32-bit system and
immeidately crashes on a 64-bit system, mainly due to the deeply baked in
assumption that 

	sizeof(int) == sizeof(long) == sizeof(char *) == sizeof(void *)

which is not always the case (even C says as much).  But it was written in a
time of flux, just after C was standardized and not everyone had an ANSI-C

> The reason I used [bp-2] instead of [bp] in my second example is that I
> supposed the latter was for the dynamic links (pointer to who called us)
> so I needed the static link (pointer to who defined us) to be somewhere
> else. I did not bother trying to remember how the ENTER and LEAVE
> instructions work so my examples probably are not compatible with them:
> https://pdos.csail.mit.edu/6.828/2012/readings/i386/ENTER.htm

  Yeah, I recently wrote code that used ENTER (works on both 32-bit and
64-bit x86 CPUs) just to figure out how it works.  I never found the
description clear and NONE of the examples actually used it for nested stack
frames (sigh).


[1]	http://www.viola.org/

[2]	Conflicting types for malloc() and fprintf(), and use of an
	obsolete header.

More information about the cctech mailing list