[fa.info-vax] Information on Unix/Vax peculiarities

info-vax (11/27/82)

>From CHUQUI@MIT-MC  Sat Nov 27 10:09:03 1982
Mail-From: ARPANET host MIT-MC rcvd at 26-Nov-82 2112-PST
To: unix-wizards@SRI-CSL
Cc: Info-vax@SRI-CSL
Remailed-Date: 27 Nov 1982 0914-PST
Remailed-From: the tty of Geoffrey S. Goodfellow  <Geoff5 at SRI-CSL>
Remailed-To: Info-VAX@SRI-CSL: ;


Here is a (probably) very obvious question. I hope there is an equally
obvious answer:

Is there some place where the obvious differences between the published
information for BSD4.1 and how things really are on a Vax machine can
be found? I am especially interested in machine differences between the
Vax and the PDP-11, which is what most of the material (including the
white book) are written for.

What I am most interested in are things like:

	The width of the various variable definitions (long, int, short, etc)
	on the Vax.

	What variable types can be used for register variables, and the 
	number of register variables available for use at any one time.

	Any internal storage changes between PDP11 C and Vax C.

	Any other machine compatibility problems that there are.

What brings this up is an interesting problem: I have a program which seems
to have been written for the PDP11. In bringing it up on the Vax, I have
been getting funny results. It seems that whoever wrote the program is doing
some funny things in a large integer array, reading and writing into it with
a character pointer. Since I assume the program did work (its problems are
much too obvious to have let through), I am assuming that there is some 
problem with how the thing handles internal storage. It seems as though
it is assuming that an integer is 16bits, stored in two bytes in a low/high
byte setup. IF I remember my PDP11, that is how it stores things. I am 
rather new to that Vax, but I believe it stores things high/low. I am
right now wondering if there are any other time bombs out there that I 
(and the rest of the net) need to be aware of.

As an aside, the program flows through lint without a single mutter. I 
have not taken the program apart as yet, but a cursory look at the code
shows me that it seems to be doing some real strange things with pointers.
I would have hoped that lint would have caught this, but evidently not.

IF you know of a general source for the differences between machines (either
Vax/PDP11 or any of the Unix machines in general), please let me know. If 
you have a particular problem, pass it along and I can summarize for the 
net.

chuck (chuqui at mit-mc)

info-vax (12/05/82)

>From mark.umcp-cs@UDel-Relay  Sat Dec  4 16:07:34 1982
Mail-From: ARPANET host UDEL-RELAY rcvd at 28-Nov-82 0809-PST
To: Charles F Von Rospach <CHUQUI@Mit-Mc>, unix-wizards@Sri-Csl
Cc: Info-vax@Sri-Csl
Via:  UMCP-CS; 27 Nov 82 20:36-EST
Remailed-Date:  4 Dec 1982 1047-PST
Remailed-From: the tty of Geoffrey S. Goodfellow  <Geoff5 at SRI-CSL>
Remailed-To: Info-VAX@SRI-CSL: ;

I have a program
	which seems to have been written for the PDP11. In bringing it
	up on the Vax, I have been getting funny results. It seems that
	whoever wrote the program is doing some funny things in a large
	integer array, reading and writing into it with a character
	pointer. Since I assume the program did work (its problems are
	much too obvious to have let through), I am assuming that there
	is some problem with how the thing handles internal storage. It
	seems as though it is assuming that an integer is 16bits,
	stored in two bytes in a low/high byte setup. IF I remember my
	PDP11, that is how it stores things. I am rather new to that
	Vax, but I believe it stores things high/low. I am right now
	wondering if there are any other time bombs out there that I
	(and the rest of the net) need to be aware of.
The Vax and the Pdp-11 both use the same byte addresses/packing
scheme in words (which, by the way, actually makes a lot of
sense).  The problem with your program is very likely just that
'int' to Vax C means 32 bits, but to pdp-11 C means '16' bits.
Try declaring the integer array to be 'short int'.