Re: #define and (brackets)



"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


.



Relevant Pages

  • Re: modifying array access syntax
    ... I published recent speculation on the ARRAY ... > are in fact remnants of the property lists of these Lisp-N ... these that were meaningful at compile time (FEXPR, FSUBR, and MACRO ...
    (comp.lang.lisp)
  • Re: DISFAVORED Was: name for 3 PICK finally?
    ... complexity is reduced by reducing the phases of execution to keep ... outside happens when the word containing the macro executes. ... LITERAL COMPILE, .... ... ``GET LITERAL @ LITERAL `EXECUTE COMPILE,'' ...
    (comp.lang.forth)
  • Re: Open stack and colon definitions as a features (was: Of course it IS!!!)
    ... execute at compile time like immediate words did thirty years ... So now we also know what color a macro has: ... In Chuck's colorforth green is more like "]" and yellow is ... They do something more like change the system's STATE to execute ...
    (comp.lang.forth)
  • Re: Open stack and colon definitions as a features (was: Of course it IS!!!)
    ... forth and macro. ... execute at compile time like immediate words did thirty years ... They do something more like change the system's STATE to execute ... the only thing I know is that it uses colors to specify ...
    (comp.lang.forth)
  • Compiling files with Preprocessor commands with DVF 5.0
    ... I am attempting to compile a code that has been primarily developed on ... several Unix platforms for the past decade. ... Predefined Preprocessor Variables under Project -> Settings but get ... from Developer Studio, does it not run it through fpp first? ...
    (comp.lang.fortran)