🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #4165

Re: Maximum length of line of C code

#4165
From: Christopher R. Volpe
Date: Tue, 03 Oct 1995 13:31
41 lines
1953 bytes
In article <44qg8v$s1m@ixnews2.ix.netcom.com>, berthold@ix.netcom.com (Richard Berthold) writes:
>
>Is there a limit to the number of characters in a physical line of C
>code which a "standard" compiler must be able to read (ie all lines
>must be less than 80 characters etc)?

Yes. All compilers must be able to handle logical source lines with at least
509 characters. Programs that have more than 509 characters in a source line
are not strictly conforming.

>Must all compilers support \ as a line continuation character? 

Yes.

>Is it
>always a continuation even if preceded by another \?

Yes. The removal of backslash-newline combinations occurrs in translation
phase 2. The only time an additional preceding backslash would be relevant is
if the whole construct occurred within a character constant or string literal.
But these preprocessing tokens do not exist until translation phase 3.

So, the following is valid code:

char *doublequote = "\\
"";

In line 1 above, there is no space after the second backslash. The first thing
that happens is the second backslash and subsequent newline annihilate each
other, leaving:

char *doublequote = "\"";

Then, we are left with a string literal containing a single
double-quote character (followed by the nul terminator, of course).

--

Chris Volpe				Phone: (518) 387-7766 (Dial Comm 8*833
GE Corporate R&D			Fax:   (518) 387-6560
PO Box 8, Schenectady, NY 12301		Email: volpecr@crd.ge.com
Technical Details
Message-ID: <44rdvu$enb@rdsunx.crd.ge.com>
Path: arc1-ca.pugleaf.net!bart.crd.ge.com!volpe
References: <44qg8v$s1m@ixnews2.ix.netcom.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!bart.crd.ge.com!volpe
From: volpe@bart.crd.ge.com (Christopher R. Volpe)
Newsgroups: comp.std.c
Subject: Re: Maximum length of line of C code
Date: 3 Oct 1995 13:31:42 GMT
Organization: GE Corporate Research & Development
Sender: volpe@bart (Christopher R. Volpe)
Distribution: world
Message-ID: <44rdvu$enb@rdsunx.crd.ge.com>
References: <44qg8v$s1m@ixnews2.ix.netcom.com>
Reply-To: volpe@ausable.crd.ge.com
NNTP-Posting-Host: bart.crd.ge.com