How many C dialects are there?

Guy Harris guy at rlgvax.UUCP
Sat Jun 16 13:27:35 AEST 1984


>     One problem with C is that there are not identified versions, such
> as FORTRAN-77 or SMALLTALK-80.  But there sure are different versions of
> the language.  At least the following are known to me, strictly from AT&T
> Unix versions.

> 	The language understood by the PWB UNIX compiler, about 1976.
> 		(in which, for arrays, x = &x)
> 	The language understood by the V7 UNIX compiler, about 1979.
> 		(typing gets stronger, "short" appears, casts appear, etc.)
> 	The language understood by the System V UNIX compiler, about 1983.
> 		("unsigned char" appears, bit fields work)

> I propose that we call these C-76, C-79, and C-83.  Are there others?

"x" and "&x" for x an array is true for all versions of the compiler up to
the System III compiler; the question is which compilers accept that construct
without comment, which give a warning, and which (if any) reject it.  The
PWB/UNIX compiler had all the features listed there for the V7 compiler, as
did the "Phototypesetter, Version Seven" compiler (which was almost the
PWB/UNIX compiler; the source differed a little bit, but I don't remember
whether the differences had any effect).

I'd propose as versions of the language:

	C as of Sixth Edition UNIX - although this one is lacking things
	like "short" and "long", and casts, which makes writing portable code
	very difficult.  (Actually, it did have "long", but it was undocumented,
	un-"supported", possibly buggy, and definitely incomplete - no long
	multiply/divide support.)

	C as of "Phototypesetter, V7"/PWB.  This was the first "modern"
	C, in the sense of having most of the features we're used to,
	like "short", "long", "unsigned", casts, etc.  I think that "#else"
	also appeared here first, and maybe macros with arguments.  Bit
	fields originally appeared here, as did unions.  The new forms
	of assignment operators ("+=" as opposed to "=+") and of initialization
	("int i = 1;" rather than "int i 1") also appeared.

	C as of V7.  This added structure assignment, structure-valued
	functions, and structure arguments, and it added enumerated data
	types.  It also added several new preprocessor features, such as
	"#if" (which was, I think, available in PWB, but not in Photo V7)
	and the "__FILE__" and "__LINE__" builtins, and the "defined()"
	operator in "#if".

	C as of System III, which also came with 4.1BSD.  This added "void"
	and "unsigned char" as official parts of the language (although I
	believe pre-S3 portable C compilers may have accepted them), and
	added new rules for structure member names making them local to
	the structure type rather than global.  4.1BSD also added long
	variable names.

	C as of System V (Release 1), which finally put the old assignment
	operators and initialization syntax to death.

	C as of System V (Release 2), which picked up Berkeley's long
	variable names.

Bell's System V "Transition Aids" document incorrectly describes several
changes that appeared in V7 and S3 as coming with S5.  I don't deal here with
versions of C not publicly released; given the multitude of UNIX development
tracks within Bell, I suspect that story is more complicated than the one
given here.

	Guy Harris
	{seismo,ihnp4,allegra}!rlgvax!guy



More information about the Comp.unix.wizards mailing list