unary +
Randall S. Becker
randy at utcsri.UUCP
Sun Apr 20 10:16:44 AEST 1986
In article <1245 at mmintl.UUCP> franka at mmintl.UUCP (Frank Adams) writes:
>
>In article <687 at bentley.UUCP> kwh at bentley.UUCP writes:
>>In article <2323 at brl-smoke.ARPA> HARGED%ti-eg.csnet at CSNET-RELAY.ARPA writes:
>>>Folks, no two ways about it: "a + +(b + c)" looks very strange (it looks
>>>like a typographical error), particularly when it is *required* to
>>>accomplish what most people intuitively assume "a + (b + c)" will
>>>accomplish. From a human factors standpoint, this proposal is a
>>>disaster.
>
>Let me repeat my suggestion that "a + [b + c]" be used for this purpose.
>It isn't *obvious* what it is intended to mean differently from "a + (b + c)",
>but it at least doesn't look like a typographical error. Use of brackets
>of arbitrary shape or size has a long mathematical tradition.
>
Forgive me for asking, but what is meant by a + +(b + c)?
Common interpretations:
a + abs(b + c) (not likely)
a + (b + c) (likely, in my opinion)
Now, if unary plus is equivalent to the generic abs() operator then why not
use abs()? I know, C doesn't have generics. I would argue that the meaning
is exactly the second case. What does + ( -1 ) mean? -1. How about
- + - 1? 1. Obviously, +1 had better be 1. The use of unary '+' as a no
sign change operator is the accepted definition in some languages developed
at the University of Toronto.
Randy
--
Randall S. Becker
Usenet: ..!utcsri!randy
CSNET: randy at toronto
More information about the Comp.lang.c
mailing list