November 2016
Intermediate to advanced
697 pages
14h 44m
English
In the previous chapters, we already used macros, such as @printf in
Chapter 2, Variables, Types, and Operations, and @time in Chapter 3, Functions. Macros are like functions, but instead of values, they take expressions (which can also be symbols or literals) as input arguments. When a macro is evaluated, the input expression is expanded, that is, the macro returns a modified expression. This expansion occurs at parse time when the syntax tree is being built, not when the code is actually executed.
The following highlights the difference between macros and functions when they are called or invoked:
Read now
Unlock full access