On Tue, Oct 25, 2005 at 07:41:11PM -0400, Howard Hinnant wrote: > I'm not convinced that "extension" is a proper term for this > behavior. It is more like an incompatibility with the rest of the > world's compilers. The reason for change is to conform to a de-facto > standard, and thus ease the migration of future gcc customers to our > compiler. > > These hypothetical customers coming from MS, EDG-based, or > CodeWarrior compilers might have code that looks like: > > // A poorly formatted comment \\ > int x = 0; > int y = 1; > ...
Howard, Have you tested the sequence above with various compilers? I just have. The behavior depends on whether there is whitespace after the \\ or not. If there is none, then EDG-based compilers will comment out the declaration of x. If there is whitespace, gcc 3.x comments it out and the others don't. I personally like the fact that gcc's behavior does not depend on invisible characters; on the other hand, there's a good argument that this behavior is ordinarily not desirable and should be warned about, except to continue strings. I have difficulty believing that it is desirable for production code to contain surprises like this.