🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #104

Bug in multiline string compilation

#104
From: "Nelson H.F. Beebe"
Date: Thu, 15 Jun 1989 23:32
43 lines
1475 bytes
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
-------
Technical Details
Message-ID: <12502428734.37.BEEBE@SCIENCE.UTAH.EDU>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!SCIENCE.UTAH.EDU!Beebe

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!SCIENCE.UTAH.EDU!Beebe
From: Beebe@SCIENCE.UTAH.EDU ("Nelson H.F. Beebe")
Newsgroups: gnu.gcc.bug
Subject: Bug in multiline string compilation
Message-ID: <12502428734.37.BEEBE@SCIENCE.UTAH.EDU>
Date: 15 Jun 89 23:32:13 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 43