Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!wugate!uunet!mcsun!ukc!edcastle!dcl-cs!aber-cs!thor!pcg From: pcg@thor.cs.aber.ac.uk (Piercarlo Grandi) Newsgroups: comp.lang.c++ Subject: Some comments on Lippman's Message-ID: Date: 6 Sep 89 11:51:45 GMT Sender: pcg@aber-cs.UUCP Organization: Coleg Prifysgol Cymru Lines: 88 I have just gone thru a cursory reading of Lippman's "A C++ primer". It is somewhat stodgy, but invaluable because it documents the new 2.0 features; the only other source I know of are the official AT&T cfront manuals... Here are some very preliminary notes, some on the book, some on the language: p. 16 Is "long float" allowed? p. 18 Octal char constants, but no hex ones? p. 18 Still no lexical concatenation of strings? (i.e. # and ## in the preprocessor should not be used?). p. 23 the reserved word "handle" is also part of a proposed extension, not just "template" p. 24 "volatile","asm", "handle" are listed as reserved words, but never mentioned thereafter. p. 24 "signed" is no included in the table of reserved words p. 35 no mention is made of the fact that a reference is always "const", e.g. "int &i = 10;" and "int &const i = 10;" are the same thing. p. 41 an array has dimension 1 when it should be 0; no zero length arrays yet? p. 41 mention that ".cc" is also a common extension. p. 72 it should be mentioned that char is guaranteed to be 1 byte (hopefully) otherwise "byte" is never defined exactly. p. 96 "while"s are designed to ensure that a condition does not exist (predicate falsifiers), not to "check" it. p. 157 The rule for promotion of "unsigned short" is quite bizarre. p. 175 Restricting foreign linkage to file scope is bizarre and ought to be rationalized. p. 179 The rule that a class is only defined at the closing brace seems to make use of static const members defined within it impossible. This is regrettable (even if the new rule that enum's are local to a class offers, for integer constants, an escape). p. 218 Rule that member functions bodies can reference not yet declared data members means that one pass compile is impossible. As far as I can tell it is the only case in C++/C where use can precede declaration (whether this is implicit or explicit). What's so wrong with declaring all data members before the functions that use them? p. 227 Is it really true that the (un)signedness of bit fields is honored, which is a (welcome) departure from C? p. 229 That constructed classes cannot be passed to ellipses is new. Explain why, also the problem with destructors if calle-initializes is done. p. 239 That "delete 0" be a no-op and not an error looks bizarre. Why? p. 240 That you need fully qualified name for an explicit destructor is ugly. p. 241 The rule for class array initialization has changed a bit; previously only the parameterless initializer was used. p. 249 The "const" in the signature of a constructor for initialization is now mandatory or not? p. 259 Why ever the "=", "[]", "()", "->", (and "->*", but is not mentioned) operators *must* be member functions? p. 271 No mention is made of the newly overloadable "," operator. It would be interesting to see cases in which it is useful. p. 292 The notion that the two syntaxes for a cast, "TYPE(expr)" and "(TYPE) expr", are non equivalent in one case strikes me as funny. p. 319 No mention is made of the syntax used to selectively change the visibility of inherited memembers. There are some general observations; the list of differences between 1.2 and 2.0 is incomplete (see some points above), as well as that between C and C++ 2.0; the version numbers have no reason to be typeset in the constat width font, that is used for code excerpts. Other quick notes; the book is over 400 pages long, and is a primer just like Stroustrup's is (but without the reference section). A lot of the extra pages are because of the bizantine subtelties of multiple inheritance, such as the long discussion of visibility rules. This is an area where the language is a bit more complicated than desirable, and the book presents the complexity unabridged. The discussion of the new streams if very cursory; a detailed discussion, like the one of the standard io library in K&R, with entry point declarations etc... would be useful (or do you want us to buy AT&T's product perforce?). Overall the impression from the book is that 2.0 is *very* different from 1.2, and in very subtle ways as well, above and beyond what my perceptions had been before (from hints dropped here in there in this forum, in Stroustrup's papers, etc...). I hope that Tiemann finishes converting G++ to 2.0 (expecially the new class local scope rule for enums!), etc... 2.0 solves many outstanding problems. Well, enough for now. -- Piercarlo "Peter" Grandi | ARPA: pcg%cs.aber.ac.uk@nsfnet-relay.ac.uk Dept of CS, UCW Aberystwyth | UUCP: ...!mcvax!ukc!aber-cs!pcg Penglais, Aberystwyth SY23 3BZ, UK | INET: pcg@cs.aber.ac.uk