🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.atari.st
Article #30534

Mark Johnson C

#30534
From: Eric Gisin
Date: Thu, 11 Feb 1988 21:35
51 lines
2530 bytes
There are several problems with the Mark Johnson C compiler.
The preprocessor doesn't do macro expansion correctly.
There are a few code generation bugs, and the C library
is missing some things and has a few bugs.
It is also missing goto which is commonly used.

I used to have Mark's (new) mail address, but I can't reach him any more.
The last I heard he was working on rewriting macro expansion,
but I don't know when and if this will be released.

I've documented the compiler bugs I know about so others can avoid them.
To get around the other problems I have a couple of solutions.

I found a public domain preprocessor (decus) I almost have working and will post
a binary when I've tested it for a while.  It also has #if, #elif and #assert.
(this is a 140K program I've compiled with MJC with only ~10 changes.
I did have to preprocess it under Unix cpp though.)

I wrote a short preprocessor to handle goto's by generating asm() statements,
which I will post as source to this group.

I suspect others have fixed things in LIB.C themselves.
If people send me fixes I'll try to merge them
and post a set of context diffs based on the original.
(I've fixed redirection and made some small extentions).

	Eric Gisin, egisin@Waterloo.EDU, watmath!egisin.

Compiler bugs:

pointer-to-function types can not be declared (in general).
sizeof((*)()) and typedef (F*)() don't work.

expressions with && and || will generate incorrect code.
to work around this parenthesise the && subexpressions, for example
	a && b || c  -->  (a && b) || c

multiple structure assignment (a = b = c) doesn't work.

when using combined operator assignments (+=, etc) the left side is evaluated
twice, not once (for example, *p++ |= BITS increments twice).

Documented features that cause many problems:

the type of initialization variables must not be (char)
and initialization values must have matching length (short or long).
I found this the most time-consuming problem in porting code.
grep all C files for '=.{' looking for char variables or structure components.
often you can change char to short.
look for things like "long STKSIZ = 4096" and use 4096L.
also make sure NULL is defined as 0L, not 0.
Technical Details
Message-ID: <16898@watmath.waterloo.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!egisin

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!egisin
From: egisin@watmath.waterloo.edu (Eric Gisin)
Newsgroups: comp.sys.atari.st
Subject: Mark Johnson C
Message-ID: <16898@watmath.waterloo.edu>
Date: 11 Feb 88 21:35:29 GMT
Distribution: comp
Organization: U of Waterloo, Ontario
Lines: 51