Usenet comp.unix.osf.misc (1992-2004)
 help / color / mirror / Atom feed
From: John Parks <parks@zko.dec.com>
Subject: Re: PGP 5.0i compile problem - LOCATED
Date: 1999/01/20	[thread overview]
Message-ID: <36A5F92C.C6EC07@zko.dec.com> (raw)
In-Reply-To: 784l4f$i2r$1@news.uk0.vbc.net

Nikola Milutinovic wrote:

>> I'm not sure what the standard says about CPP directives. I remember
>> reading that NewLines, Tabs and Spaces are treated as WhiteSpace and
>> that you can write the whole program in a single line, if you like.
>> Well, not with Digital, apparently. This problem is totaly the "feature"
>> of cpp.

The ANSI standard says that cpp directives can begin in any column -- so long
as the initiating # is the first non-whitespace character on the line.
Indentation is cool then -- so long as you preprocess the input in an
ANSI-compliant cpp mode.  Those modes include -std and -std1 but NOT -std0
which is the default.

>> This problem is totaly the "feature" of cpp.

Right.  -std0 mode is "K&R compatibility" mode and Kernighan and Ritchie
insisted that cpp directives begin in column 1.

One could argue that the K&R behavior is a feature, not a bug.  It allows
for faster preprocessing than the ANSI model (since the cpp can do a fast
scan down column 1 rather than have to consider whitespace).  It also improves
the cpp's ability to preprocess general text input (fortran, makefiles, etc.)
since #'s that aren't in column 1 are not an issue.

>> Since this feature of cpp persists in both 3.2 and in 4.0 versions, it
>> is highly unlikely we'll see it changed.

Right.  Too many users rely on the K&R behavior to change it.

>> Any feedback, sugestions and advice is welcome.

Sure.  Add -std to your command-line.  That'll change modes from "K&R" to
"relaxed ANSI" and your code work without modification.

Hope this helps.

\John Parks (Digital UNIX cpp author)







  reply	other threads:[~1999-01-20  5:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-01-19  5:00 PGP 5.0i compile problem - LOCATED Nikola Milutinovic
1999-01-20  5:00 ` Andrew Moar
1999-01-20  5:00   ` Ray Bellis
1999-01-20  5:00     ` John Parks [this message]
1999-01-21  5:00     ` Martin Vorlaender
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox