groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Groff] pic: nasty little trap in function!


From: Doug McIlroy
Subject: Re: [Groff] pic: nasty little trap in function!
Date: Mon, 02 Mar 2015 21:41:41 -0500
User-agent: Heirloom mailx 12.5 7/5/10

 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.

Doug



reply via email to

[Prev in Thread] Current Thread [Next in Thread]