Macro: Usually put some commonly used strings, basically leave the definition macro
1. Compile time is different: const is compiled at the time of compilation, the macro is compiled at the time of compilation (pre-compilation is the program load, Xcode will have a progress bar, show progress, this time is actually in pre-compilation)
2. Compile detection: const has compile detection, and macro does not compile detection
3. Benefits of Macros: You can define methods and functions
4. Macro Disadvantages: Large use of macros can lead to too long precompilation time
The role of the const
1.const is only used to modify the right variable (basic variable, pointer variable)
2. Const-Modified variables are read-only
For example:
After adding a const, A is read-only and cannot be assigned a value
Define the difference between a macro definition and a const constant definition