Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!ulysses!hector!jss From: jss@hector.UUCP (Jerry Schwarz) Newsgroups: comp.lang.c++ Subject: Re: associativity question for << Message-ID: <11605@ulysses.homer.nj.att.com> Date: 27 May 89 03:32:38 GMT References: <224@pink.ACA.MCC.COM> Sender: netnews@ulysses.homer.nj.att.com Reply-To: jss@hector.UUCP (Jerry Schwarz) Organization: AT&T Bell Laboratories Lines: 17 In article <224@pink.ACA.MCC.COM> rfg@MCC.COM (Ron Guilmette) writes: >Consider the following short program. In what order should >the addition operations in "main" be performed? > >Does the language definition insist on any particular ordering >for these addition operations? If so, what is the required order? > C++, like C, does not in general (there are some well defined exceptions) specify the order of evaluation of subexpressions or of argument lists. This is intended to provide the compiler with flexibility to choose an efficient ordering. In cases where subexpressions have side effects and order matters you must write the code to explicitly force your desired order. Jerry Schwarz AT&T Bell Labs, Murray Hill