May 2019
Beginner to intermediate
466 pages
10h 44m
English
In previous chapters, we have 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 descriptions highlight the difference between macros and functions when they are called or invoked:
Read now
Unlock full access