Domanda

I have been testing some nested macro invocations, and they worked as expected (...as expected by me!) For instance, supposing a ficticious add macro and the following expression:

add(1, add(2, 3))

Firstly the inner add is expanded (2 + 3) and secondly the outter one does its part (1 + (2 + 3)). I have seen that the outter macro does not receive any noise from the internal invocation -in the input expression- so the inner expansion seems totally transparent to it. Does this fact always hold (even with more complex macros and types)? Is it safe to do so?

È stato utile?

Soluzione

Innermost macros are always expanded first (even if they are provided as by-name arguments).

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top