Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!uwm.edu!spool.mu.edu!snorkelwacker.mit.edu!hsdndev!cmcl2!adm!smoke!gwyn From: gwyn@smoke.brl.mil (Doug Gwyn) Newsgroups: comp.std.c Subject: Re: Function Argument Evaluation Message-ID: <15565@smoke.brl.mil> Date: 25 Mar 91 08:36:18 GMT References: <17809@crdgw1.crd.ge.com> <15552@smoke.brl.mil> <1991Mar23.014442.24307@cs.ucla.edu> Organization: U.S. Army Ballistic Research Laboratory, APG, MD. Lines: 21 In article <1991Mar23.014442.24307@cs.ucla.edu> jon@maui.cs.ucla.edu (Jonathan Gingerich) writes: >I'm confused. 3 answers have been given to the question. If I understand >Doug's last answer, p may be either &x or &y after the statement, but I >don't see how this affects the value of (p=&x) and (p=&y) which would >remain &x and &y (given the correct type of p). There is a (possibly apocryphal) story told about Dirac. It seems that he gave a talk on some work he had done, and asked if there were any questions. A member of the audience said "Professor Dirac, I don't understand how you derived that equation." Dirac replied "That is not a question." However, guessing what your question might have been were you to have asked one, I'll point out that the previously cited sentence from the C standard, "The order of evaluation of the function designator, the arguments, and subexpressions within the arguments is unspecified, but there is a sequence point before the actual call", makes it quite clear that a conforming implementation is allowed to interleave evaluation of the two function argument expressions in question. In particular, it can perform both assignments to the variable p before applying the * operator, and thus could obtain the same value for both expressions.