Article View: borland.public.jbuilder.java.language
Article #16365Re: Operator precedence
From: Steve Schafer (TeamB)
Date: Thu, 04 Mar 1999 00:00
Date: Thu, 04 Mar 1999 00:00
28 lines
1483 bytes
1483 bytes
On Thu, 4 Mar 1999 10:38:38 +0530, "MM" <manu_mathew@geocities.com> wrote: >I am asking the system to increment the *variable* i and then >increment it again. No, you're not. The ++ operator does the following: 1) Obtain the value of the argument. 2) Increment that value. 3) Store the new, incremented value back into the argument. 4) Return the new value as the result of the expression. Thus, the result of the expression i++ is a _value_, not a variable. (If you come from a C/C++ background, you might know this as the difference between an lvalue and an rvalue.) So, applying the pre- or post-increment operator to i++ makes no more sense than the following: 42++ If you follow the steps above for this example, you see that it fails at step 3, because there is no place to store the new value. The same is true in your original example. -Steve
Technical Details
Message-ID:
<36f83677.57450468@90.0.0.40>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<7bjhbh$23j5@forums.borland.com> <uogmatwur.fsf@sds.no> <7bl4e5$35b15@forums.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,5de188e6c0bc95e3 X-Google-Attributes: gidf74b3,public From: pandeng@telepath.com (Steve Schafer (TeamB)) Subject: Re: Operator precedence Date: 1999/03/04 Message-ID: <36f83677.57450468@90.0.0.40> X-Deja-AN: 451072379 Content-Transfer-Encoding: 7bit References: <7bjhbh$23j5@forums.borland.com> <uogmatwur.fsf@sds.no> <7bl4e5$35b15@forums.borland.com> Content-Type: text/plain; charset=us-ascii Organization: TeamB Mime-Version: 1.0 Reply-To: pandeng@telepath.com Newsgroups: borland.public.jbuilder.java.language