Are the criteria for Unix and PC compilers different?

Peter da Silva peter at sugar.UUCP
Fri Mar 18 23:08:16 AEST 1988


In article ... backstro at silver.bacs.indiana.edu (Dave White) writes:
>When will they
>realize that some of us really want the option of using 32-bit ints to
>port Unix-born code?

* UNIX does not imply 32 BITS.

My first porting nightmare was getting a PDP-11 UNIX program with 16 bit ints
to run on a VAX under UNIX with 32 bit ints. Most everything went together
well, but there were places where the following assumptions were made:

	-1 == 0xFFFF
	32767<<1 < 0
	sizeof(int) == 2
	sizeof(char *) == 2

* 32 bit machine does not imply sizeof(int) == 4.

There are compilers for 32-bit machines for which sizeof(int) = 2. This is a
bit more effcient on the 68000, for example.

* sizeof(int) == 4 does not imply sizeof(int) == sizeof(char *).

In fact on the prime sizeof(char *) does not even equal sizeof(float *).
-- 
-- Peter da Silva  `-_-'  ...!hoptoad!academ!uhnix1!sugar!peter
-- Disclaimer: These U aren't mere opinions... these are *values*.



More information about the Comp.lang.c mailing list