Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #13958
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!news.musoftware.de!wum.musoftware.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail |
|---|---|
| From | Ian Collins <ian-news@hotmail.com> |
| Newsgroups | comp.lang.c++ |
| Subject | Re: The or operator and the preprocessor? |
| Date | Mon, 13 Feb 2012 15:59:15 +1300 |
| Lines | 21 |
| Message-ID | <9prck4F2i6U1@mid.individual.net> (permalink) |
| References | <jh9ra0$2h3$1@speranza.aioe.org> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Trace | individual.net Inzuu6vNFHyefUNnmYOkuQokyPJ9Ugy20A+tzL8N8Hy6DizuXR |
| Cancel-Lock | sha1:bk2zGiiB2djxQQ9Luux10rlNUgg= |
| User-Agent | Mozilla/5.0 (X11; SunOS i86pc; rv:6.0.2) Gecko/20111003 Thunderbird/6.0.2 |
| In-Reply-To | <jh9ra0$2h3$1@speranza.aioe.org> |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.c++:13958 |
Show key headers only | View raw
On 02/13/12 03:08 PM, glen herrmannsfeldt wrote:
> error: "or" cannot be used as a macro name as it is an operator in C++
>
> In C, the preprocessor does what its name says, and occurs before
> the compiler sees tokens and reserved words.
>
> Is that not true in C++?
>
> extern "C" {
> #include<stdio.h>
> #define or "hi there!\n"
> int main() {
> printf( or );
> }
> }
The error is valid, "or" is the alternative token for "||" in C++.
Redefining it is a bad idea.
--
Ian Collins
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
The or operator and the preprocessor? glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2012-02-13 02:08 +0000
Re: The or operator and the preprocessor? Ian Collins <ian-news@hotmail.com> - 2012-02-13 15:59 +1300
Re: The or operator and the preprocessor? glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2012-02-13 05:32 +0000
Re: The or operator and the preprocessor? Ian Collins <ian-news@hotmail.com> - 2012-02-13 20:27 +1300
csiph-web