🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.lang.c++
Article #13

porting C++

#13
From: Bjarne Stroustrup
Date: Sat, 15 Feb 1986 15:45
57 lines
3155 bytes
> From: page@ulowell.UUCP (Bob Page)
> Newsgroups: net.lang.c++
> Subject: Non-SysV versions
> Date: Fri, 14-Feb-86 11:33:58 EST
> Organization: University of Lowell

> I've just ordered c++ from AT&T, for SV (of course).  I don't run SysV;

Really, so why did you order the SysV version? Seriously, though, the standard
distribution tape has a BSD version on it. Just say ``make'' in the bsd directory
and it makes itself on a BSD. Did you notice that you can ask for either a cpio
tape or a tar tape? The only difference between SysV and BSD for the translator
is that the Berkeley people has a slightly different stdio.h. The translator
depends only on <stdio.h> and <ctype.h>. This typically makes porting trivial.
Actually, I work on an 8th Edition, so the C++ translator couldn't depend on
specific features particular to either SysV or BSD.

The translator comes with a full set of header files for SysV (but not with
a full set for BSD).

> I intend to port it to 4.[23]BSD, Ultrix-32 V1.[012] and DG/UX (a SysV
> lookalike with nearly full 4.2BSD libraries too).

Don't worry too much about porting C++. I it quite easy once you get used to it.
Just compile the translator C++ source into (intermediate) C for the target
machine. For that you use the -I option to supply standard headers for the target
system and +x to supply size and alignment information for the target system.
You then compile the resulting C on the target system and it ought to work.
Often it does not because of mistakes you make or because of bugs in the target
machine's C compiler. For example, the Apollo compiler can/could not handle
		switch (i) {
			int a;	// <*** the problem
		case 1:
			...
		};
so you have to move the declaration of "a" in the intermediate C code.
(this C compiler bug were reported to Apollo 3 years ago). Another example:
the Sun C compiler used not to accept constructs like ``(int) a/2''. The cast
was the problem. A nastier class of problem occurs when you get the size/align
file wrong. Maybe someone could post ``good'' size/align files for machines on
the net?

A reminder: You need a machine with near a megabyte of memory to have the
translator translate itself without modification. You need a C compiler that
handles structure assignment, and a linker that supports long names (you can
live with 31 characters, but more is better). You need a system that provides
a stdio.h.

> Thanks -
>
> ..Bob
> -- 
> UUCP: wanginst!ulowell!page	Bob Page
> ARPA: page@ulowell.CSNET 	U of Lowell CS Dept
> VOX:  +1 617 452 5000 x2233	Lowell MA 01854 USA

	- Bjarne Stroustrup (AT&T Bell Labs, Murray Hill)
Technical Details
Message-ID: <4982@alice.uUCp>
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!allegra!alice!bs

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.1 6/24/83; site alice.UUCP
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!allegra!alice!bs
From: bs@alice.UucP (Bjarne Stroustrup)
Newsgroups: net.lang.c++
Subject: porting C++
Message-ID: <4982@alice.uUCp>
Date: Sat, 15-Feb-86 10:45:04 EST
Article-I.D.: alice.4982
Posted: Sat Feb 15 10:45:04 1986
Date-Received: Sun, 16-Feb-86 05:54:15 EST
Organization: Bell Labs, Murray Hill
Lines: 57