Hello,
In response to a discussion, I've posted a new coco 1.25.
The new feature is an optional check of macro and text block
actual arguments to warn when enclosing parenthesis
may be helpful. For example, consider the (canonical) case:
?? macro :: hypot( x, y) = sqrt( ?x?*?x? + ?y?*?y?)
and used as
write( *, *) hypot( a+b, c+d)
which will result in
write( *, *) sqrt( a+b*a+b + c+d*c+d)
when sqrt( (a+b)*(a+b) + (c+d)*(c+d))
may have been intended.
Selecting -p on the command line, or placing
?? parens: on
in the setfile will cause a warning to be issued
(if warnings have not been turned off) when coco
thinks an actual argument to a macro or a text block
may need enclosing parenthesis.
Note that it is de rigueur for C programmers
using cpp macros to place enclosing parenthesis
around actual arguments. The new feature of coco
can supply a warning to Fortran programmers
of perhaps unintended effects.
As always, please inform me of any unexpected behavior
of coco.
--
Cheers!
Dan Nagle
Purple Sage Computing Solutions, Inc.
|