From 5722381693495871079
X-Google-Thread: f78e5,6978327f896d5d5b
X-Google-Attributes: gidf78e5,public
X-Google-Language: ENGLISH,ASCII
Path: g2news1.google.com!news4.google.com!news3.google.com!news.glorb.com!newsgate.cistron.nl!news.nl.colt.net!colt.net!peer-uk.news.demon.net!kibo.news.demon.net!news.demon.co.uk!demon!stump.algebra.com!devnull
From: jdennett@acm.org (James Dennett)
Newsgroups: comp.std.c++
Subject: Re: What is the use of the null directive # ?
Date: Thu, 19 May 2005 06:39:06 GMT
Organization: Cox Communications
Lines: 59
Sender: mail2news@demon.net
Approved: fjh@cs.mu.oz.au (Fergus Henderson , moderator of comp.std.c++)
Message-ID: <9rWie.144$rp.102@fed1read07>
References: <607f883e.0406251028.5412fc80@posting.google.com> <PDUseaDh1V3AFwzm@robinton.demon.co.uk> <barmar-AEE035.22095526062004@comcast.dca.giganews.com> <d6d9cj$jnr$1@sklad.atcom.net.pl>
NNTP-Posting-Host: news.news.demon.net
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: quoted-printable
X-Trace: news.demon.co.uk 1116484752 18665 158.152.254.254 (19 May 2005 06:39:12 GMT)
X-Complaints-To: abuse@demon.net
NNTP-Posting-Date: Thu, 19 May 2005 06:39:12 +0000 (UTC)
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7.5) Gecko/20041217
X-MIME-Autoconverted: from 8bit to quoted-printable by mulga.cs.mu.OZ.AU id j4J6d9D4029105
X-Accept-Language: en-us, en
X-Virus-Scanned: by amavisd-new at cs.mu.OZ.AU
X-Path: comp-std-cpp-robomod!not-for-mail
X-Received: (from fjh@localhost)
	by mulga.cs.mu.OZ.AU (8.12.10+Sun/8.12.9/Submit) id j4J6d6Ae029079;
	Thu, 19 May 2005 16:39:06 +1000 (EST)
X-NNTP-Posting-Date: Thu, 19 May 2005 02:33:41 EDT
X-Delivered-To: std-c++@ucar.edu
X-Authentication-Warning: fed1read07.mgt.cox.net: news set sender to newsmaster@cox.net using -f
X-Newsgroups: comp.std.c++
Xref: g2news1.google.com comp.std.c++:4805

Krzysztof =AFelechowski wrote:
> U=BFytkownik "Barry Margolin" <barmar@alum.mit.edu> napisa=B3 w wiadomo=
=B6ci=20
> news:barmar-AEE035.22095526062004@comcast.dca.giganews.com...
>=20
>>In article <PDUseaDh1V3AFwzm@robinton.demon.co.uk>,
>>francis@robinton.demon.co.uk (Francis Glassborow) wrote:
>>
>>
>>>In article <607f883e.0406251028.5412fc80@posting.google.com>, Prateek =
R
>>>Karandikar <kprateek88@yahoo.com> writes
>>>
>>>>What is the use of the null-directive # ?
>>>>
>>>><quote>
>>>>  16.7 Null directive           [cpp.null]
>>>>1  A preprocessing directive of the form
>>>>      # new-line
>>>>  has no effect.
>>>></quote>
>>>
>>>It allows implementors to add directives as extensions without having
>>>impact on the portability of code using them.
>>
>>All it says is that the line:
>>
>>#
>>
>>is ignored.  How does that allow an implementor to add something like:
>>
>>#foobar
>>
>>?
>>
>=20
>=20
> It is very simple.
>=20
> #ifndef IT_IS_MY_COMPILER
> #define foobar
> #endif
>=20
> If it is not my compiler, the pragma #foobar is reduced to a hash mark =
#.=20
> If it is, it remains and my compiler can handle it.

Except that macro expansion happens too late for that to work;
#foobar is recognized as an (invalid) preprocessor directive
before macro expansion is attempted.

-- James

---
[ 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.jamesd.demon.co.uk/csc/faq.html                       ]



