Brass Core Plugins

define

Syntax

.define name(args) substitution
.define name [substitution]

Remarks

Macros perform 'stupid' text substitution. This can cause problems with operator order of precedence if you try and use macros as functions.

Example

A problem with text-replacement macros.

.define product(x, y) x * y

; This outputs six as expected.
.echoln product(2, 3)

; This outputs four, incorrectly!
.echoln product(1 + 1, 1 + 1 + 1)

; By adding extra parentheses, this 'works'.
.define product2(x, y) (x) * (y)
.echoln product2(1 + 1, 1 + 1 + 1)