(e-mail address removed) (Michael Wojcik) writes:
[...]
Allow string literals to extend across lines.
Begin a string literal on line N. Omit the closing quote character.
Where does that literal end? At the next quote character in the
file, regardless of where it occurs.
Now, as soon as you accidentally leave off the closing quote from
a string literal, you invert what's a string literal and what's
not, for the remainder of the source file:
char *foo = "whoops; /* one string */
char *bar = "something else";
Here, if string literals were allowed to continue past the end of
the line, foo would point to a string beginning with "whoops;" and
ending with "bar = ". "something else" would not be a string
literal, and so forth.
The resulting diagnostics are likely to be ugly, and in some
circumstances quite confusing.
Perl allows multi-line string literals. If you forget to close one,
you'll get an error message on the next line that has a quotation
mark, but it will generally say something like:
Backslash found where operator expected at foo line 8, near "print "\"
(Might be a runaway multi-line "" string starting on line 5)
So *if* C allowed multi-line string literals, it would be possible to
produce reasonable diagnostics, at least in most cases.