[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Groff] pic: nasty little trap in function!
From: |
Werner LEMBERG |
Subject: |
Re: [Groff] pic: nasty little trap in function! |
Date: |
Tue, 03 Mar 2015 06:11:19 +0100 (CET) |
> Tadziu Hoffmann wrote:
> a better definition would have been:
> define d2r {($1)*pi/180}
>
> Yes. Macros are expanded by simple textual substitution. They are
> totally disconnected from the language syntax. It is a cardinal
> rule that parameters which you see as subexpressions in formulas be
> parenthesized in the macro definition to assure that they are
> treated as such regardless of what is substituted. The same rule
> applies to macros in C and troff. We all learn it the hard way.
:-) The recommendation to use parentheses is explicitly mentioned in
the pic manual, section 14 (`Macros').
Werner