ANSI C and C++

Bjarne Stroustrup bs at alice.UUCP
Wed Jul 18 00:55:11 AEST 1990




henry at zoo.toronto.edu (Henry Spencer @ U of Toronto Zoology) writes:

 > >  Does anyone know of a text that describes the differences between
 > >ANSI C and C++ 2.0? I'm trying to compile ANSI C headers with
 > >a C++ compiler and not getting too far. 

 > The best book for this is the new Annotated C++ Reference Manual (Ellis
 > and Stroustrup, Addison-Wesley 1990).  Be warned that it's expensive.
 > Be warned, also, that it describes the current version of C++, and most
 > compilers don't implement that yet.

	I'd like to try to prevent a couple of potential (and probably
	uninented) misconceptions:

	The ARM has 457 pages and a recommended price of US$37.75. That is,
	about 8 cents a page and - I think - quite reasonable compared with
	books of a similar quality and page count. In addition, the ARM is
	hardcover and printed on nice paper.

	My personal opinion is that ALL books are too expensive and in
	particular that the price increase that most books suffer when
	sold in continental Europa is shocking, but that is a separate
	issue and that it would be unfair to single out the ARM as
	particularly expensive.

 > That last point deserves emphasis:  you're going to have to be more
 > precise than "a C++ compiler".  C++ has evolved quite a bit since the
 > old Stroustrup book, and various compilers implement slightly different
 > languages.

	Yes, agreed 100%. However please also note that most C++ compilers
	currently shipped (AT&T 2.0 and 2.1 ports, Turbo C++, Zortech 2.1,
	ect.) are actually quite close; the ARM is not simply a paper design
	for an unimplemented language. The efforts of the C++ standards
	committee and of its members which includes most C++ compiler purveyers
	- and currently even most C++ compiler writers - makes further
	convergence probable.

	Older, 1.? versions differ to a greater extent. I think it could be
	argued that the relative differences between 1.? and 2.1 are of the
	order of the relative differences between Classic C and ANSI C.

	FYI:

		Ellis & Stroustrup: The Annotated C++ Reference Manual
		Addison Wesley, 1990. 450 pages. ISBN 0-201-51459-1

	To return to the original question: There shouldn't be problems
	compiling ANSI C headers with a C++ compiler provided the headers
	don't rely on the 

		int f(); /* f() accepts all kinds of arguments */

	trick. In addition, many `ANSI C' compilers accept `extensions' -
	such as allowing casts as lvalues - for compatibility with
	Classic C dialects. Most such `extensions' are errors in C++.

	The ARM lists the differences between ANSI C and C++.



More information about the Comp.lang.c mailing list