Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder2.hal-mli.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!news2.euro.net!multikabel.net!newsfeed20.multikabel.net!border3.nntp.ams.giganews.com!Xl.tags.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!local2.nntp.ams.giganews.com!nntp.brightview.co.uk!news.brightview.co.uk.POSTED!not-for-mail NNTP-Posting-Date: Thu, 12 Jan 2012 13:36:42 -0600 From: Gareth Owen Newsgroups: comp.lang.c++ Subject: Re: Simultaneous read and write on a variable in C++ References: <47e6756d-03b0-47a7-ad82-93b6ffe14ed3@k8g2000yqk.googlegroups.com> Date: Thu, 12 Jan 2012 19:36:47 +0000 Message-ID: <87ipkglnlc.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:OYLxt+doqa6CX4gIOgkJ1Ptkf1Y= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Lines: 17 X-Usenet-Provider: http://www.giganews.com X-Trace: sv3-f1LQvuN6cuhBtvBzmDbuMH5cGYaqDojVO8ISnOikf96InYHMOFBGc76UhJtxc1OvCMnOcbnt6NYxm5D!LjaMzEuA350UIUYV18RbWP94QdzEUWTzAfJSZ6XP3wzDYyBdPPiSzM4u7rGws6OG4hRPkg== X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 1898 Xref: x330-a1.tempe.blueboxinc.net comp.lang.c++:13298 Prasoon Saurav writes: >> You're not deferencing p, you're dereferencing the result of (p=a) >> which is (unambiguously) a. > > The result of (p=a) is lvalue 'p' with its rvalue 'a'. "The result of the assignment operation is the value stored in the left operand _after the assignment has taken place_; the result is an lvalue." [C++ standard : expr.ass] "The assignment operators return the value of the object specified by the left operand *after the assignment*" (my emphasis) http://msdn.microsoft.com/en-us/library/b0zx90af%28v=vs.80%29.aspx Any other interpretation would make C++ gratuitously incompatible with C.