From -6835480227840876181
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: f78e5,fbc32fc9914fa748
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 2000-12-08 11:53:18 PST
Path: supernews.google.com!sn-xit-02!supernews.com!bignews.mediaways.net!newscore.gigabell.net!newsfeeds.belnet.be!news.belnet.be!btnet-peer1!btnet-peer0!btnet!dispose.news.demon.net!demon!news.demon.co.uk!demon!mail2news.demon.co.uk!not-for-mail
From: strieder@student.uni-kl.de
Newsgroups: comp.std.c++
Subject: Re: Preprocessor directive and newline
Date: Fri,  8 Dec 2000 19:52:14 GMT
Organization: =?iso-8859-1?Q?Universit=E4t?= Kaiserslautern
Approved: Fergus Henderson <fjh@cs.mu.oz.au>, moderator of comp.std.c++
Message-ID: <3A30F130.96B9A9D6@student.uni-kl.de>
References: <90onv1$dci$1@front7.grolier.fr>
X-Trace: mail2news.demon.co.uk 976305140 mail2news:25046 mail2news mail2news.demon.co.uk
X-Complaints-To: abuse@demon.net
X-Mail2News-Path: news.demon.net!mulga.cs.mu.oz.au
X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
X-Accept-Language: en
Content-Transfer-Encoding: quoted-printable
X-MIME-Autoconverted: from 8bit to quoted-printable by mulga.cs.mu.OZ.AU id GAA11938
Lines: 42
Xref: supernews.google.com comp.std.c++:2837

"Fran=E7ois-Xavier Callewaert" wrote:
>=20
> Why does the standard C++ require that a preprocessor directive be the
> only "thing" on a line(16.1) ?
>=20
>  I can readily understand why  it should be the last "thing" on a line,
> but why should it also be the first ?
>=20
>  Appart from the fact that the following line of code is probably harde=
r to
> read then the legal alternative is it somehow bad ?
>=20

cout<<"#define BAR"<<endl;

The preprocessor would have to first scan the line completely to
recognize whether and where a preprocessor directive starts. Here there
is none, but a string constant that would have to be recognized at
first.

With the current rule it can decide by the first non-whitespace of a
line, if there is a preprocessor directive or not. Preprocessing
directives are removed during preprocessing, this is very easy to do
with the current rules.

The lexical analysis would become remarkably more complex if the rules
allowed appending directives to other lines of code, since alle lines
would have to be fully scanned to find all directives. This slows the
preprocessor down.

So nobody really wants it. It's quite unreadable for programmers, it
adds complexity to the preprocessor, and it slows it down.

Bernd Strieder

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]
[ Note that the FAQ URL has changed!  Please update your bookmarks.     ]



