[comp.text] !'\\$1'' vs. \w'\\$1' in TROFF

bink@aplcen.apl.jhu.edu (Ubben Greg) (08/15/89)

What are the advantages and disadvantages of using
	.if \w'\\$1' ...
instead of
	.if !'\\$1'' ...
in DWB 2.0 DiTroff macros?  Although the latter seems more readable, I've
seen the former used enough times to wonder about it.  I apologize for the
trivial nature of this question, but I want my macros to be as robust as
possible.  You TROFF wizards might offer your E-mail address if you object
to this posting (it's much too low-level to be covered in any references I
know of).

						-- Greg Ubben
						   bink@aplcen.apl.jhu.edu
						   !mimsy!aplcen!bink (I think)

henry@utzoo.uucp (Henry Spencer) (08/16/89)

In article <2658@aplcen.apl.jhu.edu> bink@aplcen.apl.jhu.edu (Ubben Greg) writes:
>What are the advantages and disadvantages of using
>	.if \w'\\$1' ...
>instead of
>	.if !'\\$1'' ...
>in DWB 2.0 DiTroff macros? ...

They're two different things.  The first asks if the width of the string
is non-zero.  The second asks whether there are any characters in it.
Remember that there are such things as zero-width characters.  People who
use the first form to test for an empty string have goofed.
-- 
V7 /bin/mail source: 554 lines.|     Henry Spencer at U of Toronto Zoology
1989 X.400 specs: 2200+ pages. | uunet!attcan!utzoo!henry henry@zoo.toronto.edu