What does preprocessing exactly mean in compiler

后端 未结 6 2188
没有蜡笔的小新
没有蜡笔的小新 2021-02-09 05:52

I am trying to understand the difference between a typedef and define. There are a lot of good posts specially at this previous question on SO, however I can\'t understand the p

6条回答
  •  难免孤独
    2021-02-09 06:14

    It means that the preprocessor runs before the compiler and it modifies the source code before passing it on to the compiler. Thus, the compiler never sees some of the code. Example:

    #define ONE 1
    int x = ONE;
    

    When you compile this, the preprocessor changes it into this:

    int x = 1;
    

    and passes that new text to the compiler. Thus, the compiler does not see the text ONE.

提交回复
热议问题