What does “macro” mean in Objective-C?

前端 未结 4 1599
被撕碎了的回忆
被撕碎了的回忆 2021-02-02 17:35

I am new to iOS development and I just want to know the meaning of macro in Objective-C?

I have found that \"macro\" is used with #define but still do not get its meanin

4条回答
  •  感动是毒
    2021-02-02 18:00

    Macros are compile time constants. That means they will replaced with actual values in the compile time.

    #define MIN_VALUE 3 // Definition
    
    
    if(x > MIN_VALUE) // Usage
    {
    
    }
    

    While compiling it actually looks like

     if(x  > 3) // During compilation
      {
    
      }
    

提交回复
热议问题