🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #3056

Re: implicitly continued string constants

#3056
From: Ron Guilmette
Date: Sun, 19 May 1991 03:08
27 lines
1630 bytes
In article <1991May15.155113.10624@zoo.toronto.edu> henry@zoo.toronto.edu (Henry Spencer) writes:
+In article <21455@ogicse.ogi.edu> morgan@ogicse.cse.ogi.edu (Clark O. Morgan) writes:
+>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)...
+>
+>So here's the question, is the following program legal ANSI C?
+
+No.  Newline is specifically excluded from the list of characters that
+can occur within an ANSI C string literal.
+
+You err in assuming that gcc is an ANSI C compiler, however.  It will try
+to pretend to be one if you give the right magic combination of options,
+but by default it compiles something which is neither old C nor ANSI C.

There is nothing "magic" about it.

Using the -pedantic and -ansi options causes GCC to complain about all
violations of ANSI C (including the one being discussed here).

If you are a pedant, you can install your copy of gcc so that these
options are always on by default.
-- 

// Ron ("Loose Cannon") Guilmette
// Internet: rfg@ncd.com      uucp: ...uunet!lupine!rfg
// New motto:  If it ain't broke, try using a bigger hammer.
Technical Details
Message-ID: <5619@lupine.NCD.COM>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!rpi!uupsi!lupine!rfg
References: <21455@ogicse.ogi.edu> <1991May15.155113.10624@zoo.toronto.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!rpi!uupsi!lupine!rfg
From: rfg@NCD.COM (Ron Guilmette)
Newsgroups: comp.std.c
Subject: Re: implicitly continued string constants
Message-ID: <5619@lupine.NCD.COM>
Date: 19 May 91 03:08:11 GMT
References: <21455@ogicse.ogi.edu> <1991May15.155113.10624@zoo.toronto.edu>
Organization: Network Computing Devices, Inc., Mt. View, CA
Lines: 27