Beebe@SCIENCE.UTAH.EDU ("Nelson H.F. Beebe") (06/16/89)
gcc 1.35 (Sun 3/110, Sun OS 4.0) fails to flag an error on a
multi-line string which is missing a backslash before a
newline. If this is a `feature', I vote for its removal,
because it fails to detect errors in code that will fail on
most, if not all, other compilers; at the very least, a
warning should be issued (possibly under control of a
run-time switch):
Here is a demo:
193 plot79>cat foo.c
#include <stdio.h>
main()
{
foo("This string is long \
and continues on 2 lines.
This is the end.");
}
foo(s)
char* s;
{
puts(s);
}
194 plot79>foo
This string is long and continues on 2 lines.
This is the end.
195 plot79>gcc -v
gcc version 1.35
Sun cc (correctly) notes the error:
196 plot79>cc -o foo2 foo.c
"foo.c", line 6: newline in string or char constant
"foo.c", line 7: syntax error at or near variable name "This"
"foo.c", line 7: newline in string or char constant
"foo.c", line 10: s undefined
"foo.c", line 11: syntax error at or near type word "char"
"foo.c", line 15: syntax error
-------