2 ms·
In general, a macro produces code at compile time, doesn't matter in which form it ends up in the binary, as long as the observable side effects are the same.
by pjmlp 2y ago
In general, a macro produces code at compile time, doesn't matter in which form it ends up in the binary, as long as the observable side effects are the same.
Example of a library that generates serialization code, https://github.com/getml/reflect-cpp https://github.com/getml/reflect-cpp
As mentioned the ongoing C++26 proposal with produce the desired source code at compile time, thus reducing the amount of code of libraries such that one.
- lispm 2y ago> In general, a macro produces code at compile time The term "macro" is overloaded. In a typical Lisp they are generating source as data, not just constant values. Lisp macros also work in interpreters and they can use arbitrary language features, incl. creating side effects or accessing external data sources.