TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: CRAIG A MCKAY
from: THOMAS MAEDER
date: 1997-05-12 21:13:00
subject: OOP

CM>  JK> This isn't right either, the right would be C + OOP == ++C :/
CM> Hmm, well, another chap helpfully pointed out that it is not stated
CM> I'd like to hear Thomas Maeder explain exactly why the results of th
CM> comparisons are unspecified.  I can't understand how that would work
CM> mean, I've written heaps of programs where changes happen on both si
CM> equality operator.  I don't doubt him, I just would like confirmatio
From "The Annotated C++ Reference Manual" (ARM) by Margaret  A.  Ellis
and  Bjarne  Stroustrup  (chapter 5, expressions, p.46): "The order of
evaluation of subexpressions is determined by the expression  grammar.
The  usual  mathematical  rules for associativity and commutativity of
operators  may  be  applied  only  where  the  operators  really   are
associative   and  commutative.  Except  where  noted,  the  order  of
evaluation of operands of individual operators is undefined."
In the expression
C + OOP == ++C 
the variable C is read twice; it's undefined whether  C  on  the  left
side is read before or after the increment on the right side.
Thomas
PS: What's the meaning of "chap"? (English is my 3rd language,  C++  my
4th :-))
---
 þ MM 1.0 #0113 þ ROBOHUSBAND: Sleeps with your wife while you're online.
---------------
* Origin: McMeier & Son BBS (2:301/138)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.