🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #4215

Re: Maximum length of line of C code

#4215
From: Norman Diamond
Date: Wed, 11 Oct 1995 05:12
49 lines
2936 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)?

I haven't seen anyone answer this exact question yet, though disk space
problems might be stopping incoming articles as well as outgoing ones.

The section on translation limits requires an implementation to handle
some lucky program that includes an instance of a 509-character logical
line (the result of translation phase 2).  It does not require an
implementation to handle any lucky program that has an instance of even
a 3-character source line (an intermediate step in translation phase 1)
let alone the shape of physical source file lines (the input to TP 1).
In fact, an implementation is not even required to document its mapping
from physical source file characters to source characters in TP 1, since
the standard does not specify it as implementation defined.

>If there is no standard limit, does anyone know of any current
>compilers with small limits ie < 512 ?

Not a standards issue :-)  However, I haven't tested any implementation
for this feature so might possibly know one without knowing it :-)

>Must all compilers support \ as a line continuation character? Is it
>always a continuation even if preceded by another \?

Yes.  This is why I think that a 2-character source line must always be
possible, since otherwise it's hard to construct a 509-character logical
line :-)

Now, I look at the wording of translation phase 2.  It does not specify
that each backslash followed by a new-line character is deleted; it
specifies that each new-line character and an immediately preceding
backslash are deleted.  This wording suggests that a backwards examination
is required, similar to detection of a preprocessing directive which
depends on examining any white space that immediately precedes a #.
Thus, it seems that the following four lines are spliced by TP2:
tok\\\


en
After each splice is performed, a newline character is observed to be
immediately preceded by a backslash.
--
 <<  If this were the company's opinion, I would not be allowed to post it.  >>
"I paid money for this car, I pay taxes for vehicle registration and a driver's
license, so I can drive in any lane I want, and no innocent victim gets to call
the cops just 'cause the lane's not goin' the same direction as me" - J Spammer
Technical Details
Message-ID: <45fjo5$2gs@usenet.pa.dec.com>
Path: arc1-ca.pugleaf.net!jrd.dec.com!diamond
References: <44qg8v$s1m@ixnews2.ix.netcom.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!jrd.dec.com!diamond
From: diamond@jrd.dec.com (Norman Diamond)
Newsgroups: comp.std.c
Subject: Re: Maximum length of line of C code
Date: 11 Oct 1995 05:12:37 GMT
Organization: DEC Japan Research and Development Center
Distribution: world
Message-ID: <45fjo5$2gs@usenet.pa.dec.com>
References: <44qg8v$s1m@ixnews2.ix.netcom.com>
NNTP-Posting-Host: jit533.jrd.dec.com