ANSIfication of 4BSD

Amos Shapir amos at taux01.UUCP
Sun Apr 3 23:50:09 AEST 1988


The bugs that men do live on after them...

This is an interesting suggestion, since I did have the chance to make such
changes, and one of them - signed sizeof - is my own idea.

Because of #4 in Chris' article (persistence of unsigned-ness), when I was
converting PCC to the tahoe at CCI, I made the decision to implement #3 (signed
sizeof); originally sizeof was unsigned. The chain of events leading
to that decision is rather interesting, and may teach us something (though
I'm not sure what):

- The first version of the machine had no FPU;
- When the FPU was put in, it was discovered that there was no more
 room in the microcode storage, and some integer instructions had to go;
- The least used instructions were unsigned mod (and div? I forget);
- Replacing them required using the 'ediv' instruction, which was not
 used or tested much till then;
- When ediv was brought into frequent use, a bug was discovered in its
 interaction with the page-fault mechanism;
- Since there was no time to fix it, a work-around was used, which required
 putting all operands in registers;
- Complicated expressions involving unsigned terms ran out of
 registers and caused 'simplify expression' messages;
- Many such expressions were generated by sizeof, which caused conversion to
 unsigned of the whole expression, even if all other terms were signed;
- Since the machine architecture itself limits sizes of objects to 1Gb,
 there was no point not to change sizeof to int.

About *void: I totally agree, I would have put it in myself if it was
standard then (1982).

-- 
	Amos Shapir			(My other cpu is a NS32532)
National Semiconductor (Israel)
6 Maskit st. P.O.B. 3007, Herzlia 46104, Israel  Tel. +972 52 522261
amos%taux01 at nsc.com  34 48 E / 32 10 N



More information about the Comp.lang.c mailing list