TITLE: The maximal munch rule PROBLEM: luj@helios.ecn.purdue.edu (John Lu) I just moved into ++ world from C. I don't see why AT&T CC 2.1 complains for the following simple code(on a Sparc +1 running SunOS4.1) friend void print(Foo&, ostream&=cout); //????? must be "ostream& = cout", i.e. must have space around "=" //????? otherwise CC complains and quit RESPONSE: Steve Clamage, TauMetric Corp (steve@taumet.com) There are similar problems in C as well, for example: int i, j, k; int *p; j = i/*p; k = j /* intermediate result */ + 1; OOPS! This turns out to be equivalent to j = i + 1; We intended to divide i by *p, but the lack of a space turned the '/*' into the start of a comment, radically changing the meaning of the code. The rule in C and C++ is that the longest sequence of characters which could be a single token is taken to be that token, even if some other interpretation would otherwise be possible. (This is sometimes called the "maximal munch" rule.) I was bitten by this when I wanted the default value of a pointer argument to be 0: foo(char*=0); This produced bizarre error messages from the compiler!