🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #2475

Re: translation phases

#2475
From: Doug Gwyn
Date: Sat, 23 Feb 1991 20:33
30 lines
1175 bytes
In article <12696@darkstar.ucsc.edu> daniel@terra.ucsc.edu (Daniel Edelson) writes:
>According to the translation phases, line splicing occurs before
>escape sequence replacement.

But after trigraph replacement.

>Therefore, a '\\newline' sequence
>in a character or string constant should translate to a single
>backslash.

Correct.

>This will be a syntax error unless it is part of
>a valid escape sequence.

Or comment, header name, etc.

>char msg[] = "\\
>t";
>This should translate to:
>msg[0] = '9';   /* tab */
>msg[1] = '0';   /* null sentinel */

Assuming the ASCII code set, the effect of the initializer is:
	msg[0] = 9;
	msg[1] = 0;
(Not quite what you said.)

I suspect there are so-called "ANSI C" compilers in existence that
get this wrong.
Technical Details
Message-ID: <15303@smoke.brl.mil>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!wuarchive!udel!haven!adm!smoke!gwyn
References: <12696@darkstar.ucsc.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!wuarchive!udel!haven!adm!smoke!gwyn
From: gwyn@smoke.brl.mil (Doug Gwyn)
Newsgroups: comp.std.c
Subject: Re: translation phases
Message-ID: <15303@smoke.brl.mil>
Date: 23 Feb 91 20:33:34 GMT
References: <12696@darkstar.ucsc.edu>
Organization: U.S. Army Ballistic Research Laboratory, APG, MD.
Lines: 30