Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!rutgers!att!dptg!ulysses!andante!alice!bs From: bs@alice.UUCP (Bjarne Stroustrup) Newsgroups: comp.lang.c Subject: Re: ANSI C and C++ Summary: book prices compatibility compilers Message-ID: <11058@alice.UUCP> Date: 17 Jul 90 14:55:11 GMT References: <1990Jul13.225712.3433@murdoch.acc.Virginia.EDU> <1990Jul14.232930.24414@zoo.toronto.edu> Organization: AT&T Bell Laboratories, Murray Hill NJ Lines: 61 henry@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++.