Re: #define and (brackets)
- From: "Alan Carre" <alan@xxxxxxxxxxxxxxxxx>
- Date: Tue, 25 Nov 2008 08:07:49 +0700
"Igor Tandetnik" <itandetnik@xxxxxxxx> wrote in message
news:epMGpUoTJHA.3520@xxxxxxxxxxxxxxxxxxxxxxx
Alan Carre <alan@xxxxxxxxxxxxxxxxx> wrote:
-SHRINK_BOX_AMOUNT won't get parsed as --20, but as - -20 (which will
likely compile just fine, but I'm too lazy to check). Preprocessor works
after lexer, handling tokens rather than individual characters. You need
## operator to create new tokens.
Nope, just try it. It won't compile, no spaces are inserted after the minus
sign. The preprocessor simply replaces the #define with -20.
And --20 is not a *new* token, it is not a token at all!
What is probably confusing you is the fact that there's only one macro here
and no arguments. If I wanted to append two "macros arguments" then I would
need to use ##. As in
#define __ADDSIGN__(SIGN,NUMBER) SIGN##NUMBER
But that's not what I wrote. I placed a minus sign before the number -20
(-SHRINK_VALUE_AMOUNT) which the preprocessor spits out as --20 (as it's
supposed to) and results in a compile error.
- Alan Carre
.
- Follow-Ups:
- Re: #define and (brackets)
- From: Igor Tandetnik
- Re: #define and (brackets)
- From: Alan Carre
- Re: #define and (brackets)
- References:
- #define and (brackets)
- From: Gerry Hickman
- Re: #define and (brackets)
- From: David Webber
- Re: #define and (brackets)
- From: Alan Carre
- Re: #define and (brackets)
- From: Igor Tandetnik
- #define and (brackets)
- Prev by Date: Re: Sugestions on learning VC++?
- Next by Date: Re: #define and (brackets)
- Previous by thread: Re: #define and (brackets)
- Next by thread: Re: #define and (brackets)
- Index(es):
Relevant Pages
|