[net.lang.c] C compiler ignors CTRL L

mark@elsie.UUCP (Mark J. Miller) (10/03/84)

Our C compiler (4.1 BSD) will ignor CTRL L's (form feeds). This is nice
because it allows one to ask for a new page at the begining of subroutines.
It is also not documented, probably non-standard, and probably should be an
error. How far back does this "feature" go? Is it in all, most, of just a
few of the compilers out there. If it is universal, shouldn't it be
documented?

-- 
Mark J. Miller
NIH/NCI/DCE/LEC
UUCP:	decvax!harpo!seismo!umcp-cs!elsie!mark
Phone:	(301) 496-5688

henry@utzoo.UUCP (Henry Spencer) (10/05/84)

> Our C compiler (4.1 BSD) will ignor CTRL L's (form feeds). This is nice
> because it allows one to ask for a new page at the begining of subroutines.
> It is also not documented, probably non-standard, and probably should be an
> error. How far back does this "feature" go? Is it in all, most, of just a
> few of the compilers out there. If it is universal, shouldn't it be
> documented?

ANSI C draft of 21 Aug 1984, section 2.0:

	"Space characters, horizontal tabs, new-lines, vertical tabs,
	form feeds, and comments ... -- collectively called *white
	space* -- are ignored except as they serve to separate tokens."

So this particular feature can be assumed to be legitimate in future
C compilers.  Unfortunately, K&R's list of white-space characters is
not as long, and does *not* include formfeed, so there are probably
a good many current compilers out there that won't like it.  On the
other hand, simply removing all the formfeeds in a file is easy with
any text editor worthy of the name, so it doesn't seem like a big
stumbling block to portability.  If you really want to be 100% portable
with current compilers, put /* */ around the formfeeds.
-- 
				Henry Spencer @ U of Toronto Zoology
				{allegra,ihnp4,linus,decvax}!utzoo!henry

crm@duke.UUCP (Charlie Martin) (10/05/84)

Isn't ^L defined to be in the class of whitespace characters?
If so, then the C compiler should ignore it because it
ignores insignificant whitespace (multitabs or spaces between
symbols, also (I think) therefore ^L etc.)

robert@erix.UUCP (Robert Virding) (10/05/84)

A simple way to make sure of getting a form feed before a function
in a legal way is just to put it into a comment, /* ^L */.

dre@ptsfa.UUCP (Doug East) (10/06/84)

> Our C compiler (4.1 BSD) will ignor CTRL L's (form feeds). This is nice
> because it allows one to ask for a new page at the begining of subroutines.
> It is also not documented, probably non-standard, and probably should be an
> error. How far back does this "feature" go? Is it in all, most, of just a
> few of the compilers out there. If it is universal, shouldn't it be
> documented?

We have compiler on a Convergent Technologies Megaframe (sys5) which exhibits
the same behaviour.  It isn't documented either, as far as I can discern.

	Doug East (Pacific * Bell)
	{ihnp4,ucbvax,cbosgd,decwrl,amd70,fortune,zehntel}!dual!ptsfa!dre

rgh@inmet.UUCP (10/07/84)

#R:elsie:-400600:inmet:5000025:000:379
inmet!rgh    Oct  5 11:09:00 1984

Form-feed is allowed as whitespace in every C compiler I know of.
This usage is recognized in the ANSI draft C standard, which says
"Space characters, horizontal tabs, new-lines, vertical tabs, form
feeds, and comments (described below) -- collectively called
white space -- are ignored except as they serve to separate tokens."

				Randy Hudson
				{ihnp4,harpo,ima}!inmet!rgh

bsa@ncoast.UUCP (Brandon Allbery) (10/07/84)

`Whitespace' means any of ' ', '\f', or '\n' -- so maybe the did document
it and we didn't notice?  (I don't have a copy of K&R so I don't know
if they actually *say* whitespace -- can someone check?)

--bsa

rmorgan@tikal.UUCP (R J Morgan) (10/11/84)

From K&R, Appendix A: C REFERENCE MANUAL, 'Lexical conventions':

	"Blanks, tabs, newlines, and comments (collectively, 
	 "white space")...

Sorry, but K&R doesn't seem to support the formfeed argument.

Tli@usc-eclb.ARPA (10/11/84)

From:  Tony Li <Tli@usc-eclb.ARPA>


>`Whitespace' means any of ' ', '\f', or '\n' -- so maybe the did document
>it and we didn't notice?  (I don't have a copy of K&R so I don't know
>if they actually *say* whitespace -- can someone check?)

K+R says that whitespace is ' ', '\t', and '\n'.  (pg. 156).

Cheers, 
Tony ;-)

marc@wlcrjs.UUCP (Marc Lavine) (10/13/84)

> Our C compiler (4.1 BSD) will ignor CTRL L's (form feeds). This is nice
> because it allows one to ask for a new page at the begining of subroutines.
> It is also not documented, probably non-standard, and probably should be an
> error. How far back does this "feature" go? Is it in all, most, of just a
> few of the compilers out there. If it is universal, shouldn't it be
> documented?

Your compiler probably includes form feeds in its definition of white space,
although K&R doesn't seem to recognize them as such (see pg. 179).
-- 
			Marc Lavine
uucp:	...ihnp4!wlcrjs!marc