implicitly continued string constants
Clark O. Morgan
morgan at ogicse.cse.ogi.edu
Wed May 15 18:24:40 AEST 1991
I noticed the other day that gcc (version 1.39) does not error
implicitly continued string constants (e.g., string constants that
contain actual newlines). This surprised me, because I personally
consider such strings to be programming typos, especially given the
alternatives available for continuing long strings (i.e., concatenation
or continuation with an explicit \n). I have been told that gcc is
ANSI C compatible.
So here's the question, is the following program legal ANSI C?
Script started on Wed May 15 00:43:44 1991
$ cat -n t.c
1 extern int printf(char *, ...);
2
3 int
4 main()
5 {
6 printf("junk);
7 string\n");
8 return (0);
9 }
$ gcc -Wall t.c <--- No complaints
$ a.out
junk);
string
$ exit
script done on Wed May 15 00:44:09 1991
Thanks in advance.
More information about the Comp.std.c
mailing list