[mod.std.c] mod.std.c Digest V8#13

osd@hou2d.UUCP (Orlando Sotomayor-Diaz) (07/18/85)

From: Orlando Sotomayor-Diaz (The Moderator) <cbosgd!std-c>


mod.std.c Digest            Thu, 18 Jul 85       Volume 8 : Issue  13 

Today's Topics:
                     C.3.3.3: unary + vs. unary -
     conforming implementation [A.7] (Re: mod.std.c Digest V8#6)
----------------------------------------------------------------------

Date: Thu, 18 Jul 85 11:20:19 EDT
From: ihnp4!seismo!elsie!ado
Subject: C.3.3.3: unary + vs. unary -
To: hou2d!osd

Earlier I noted the difference between descriptions of the effect of unary +
and unary - in section C.3.3.3, page 31:

	. . .Except that it inhibits regrouping, the expression +E
	is equivalent to (0+E).

	. . .The expression -E is equivalent to (0-E).

Mark Brader (hcr!lsuc!msb) has written:

> The standard is correct.  Regrouping only takes place where the operators
> are commutative and associative, which binary - is not.  Therefore (0-E)
> inhibits regrouping also, and the words "Except that it inhibits regrouping"
> are correctly omitted from the statement regarding -.  On the other hand,
> (0+E) does not inhibit regrouping, so the words are correctly included there.

Well. . .suppose that E is (a + (b + c)).  If I understand alright, if I write
	(0-(a + (b + c))
then this may be (regroupedly) computed as
	(0-((a + b) + c))
whereas if I write
	-(a + (b + c))
such a regrouping is not allowed.  So the second sentence quoted from the draft
above really should be changed to:

	. . .Except that it inhibits regrouping, the expression -E
	is equivalent to (0-E).

--
	UUCP: ..decvax!seismo!elsie!ado    ARPA: elsie!ado@seismo.ARPA
	DEC, VAX and Elsie are Digital Equipment and Borden trademarks

------------------------------

Date: 14 Jul 85 14:31:38 N (Sun)
From: seismo!mcvax!guido
Subject: conforming implementation [A.7] (Re: mod.std.c Digest V8#6)
To: std-c@cbosgd

>From: John White <mcnc!jnw>
>Subject: conforming implementation [A.7]
>
>                      But what if, due to the way its implemented, a
>compiler has slightly less strict syntax than the standard requires and
>produces reasonable code when given source using this syntax?
>Adding checks for this situation would make the compiler bigger and slower.

The rule given in the standard requires the error messages because the
program could otherwise be non-portable without the user ever finding out!
(Assuming the user uses the compiler to check the program, not the manual
-- a reasonable assumption, and certainly common practice.)
I would be happy with warnings only, though, and a way to turn specifically
those warnings off that only warn about portability aspects..

	Guido van Rossum, CWI, Amsterdam.  guido@mcvax.UUCP

------------------------------

End of mod.std.c Digest - Thu, 18 Jul 85 15:23:08 EDT
******************************
USENET -> posting only through cbosgd!std-c.
ARPA -> ... through cbosgd!std-c@BERKELEY.ARPA (NOT to INFO-C)
In all cases, you may also reply to the author(s) above.