Marcos vs Functions¶
Marco Definition¶
Macros are pre-processed which means that all the macros would be processed before your program compiles. However, functions are not preprocessed but compiled.
Comparsion¶
- Marco
- Preprocessed
- No type checking done in Marco
- Faster
- Useful when small code is repeated many times
- Doesn't check compile time error
- Function
- Compiled
- Type checking is performed
- Slower
- Large code piece
- Check compile-time error
Last update:
January 9, 2021