Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Re: Looking for good table with all Java operators

Reply
Thread Tools

Re: Looking for good table with all Java operators

 
 
Lew
Guest
Posts: n/a
 
      01-26-2010
Robbo wrote:
> Level Category Operator Associativity
> ---------------------------------------------------------------
> 1 postfix expr++ expr-- left


As I was corrected upthread (perhaps you missed that post), there is no
associativity for postfix operators.

--
Lew
 
Reply With Quote
 
 
 
 
Lew
Guest
Posts: n/a
 
      01-26-2010
Please attribute quotations.
Lew wrote:
>> As I was corrected upthread (perhaps you missed that post), there is no
>> associativity for postfix operators.


Robbo wrote:
> Ok. Thx.
>
>
> Level Category Operator Associativity
> ---------------------------------------------------------------
> 1 postfix expr++ expr-- +
> ---------------------------------------------------------------
> 2 prefix ++expr --expr right+


The same reasoning applies to prefix auto{in,de}crement.

It's been pointed out before, although to be fair, to reach the conclusion it
would have required thinking about what Patricia posted.
> ++(a--) and (++a)-- both apply an operator
> requiring a variable to a non-variable value.


There's no point talking about associativity of prefix ++ if ++++x is an
illegal expression. (Or if it means that unary + is applied twice to ++x - I
didn't try it. Why don't you? It'll be a fun experiment.)

Thinking about things is a fundamental tool in the programmer's toolbox.

--
Lew
 
Reply With Quote
 
 
 
 
Tom Anderson
Guest
Posts: n/a
 
      01-26-2010
On Tue, 26 Jan 2010, Thomas Pornin wrote:

> According to Lew <(E-Mail Removed)>:
>> There's no point talking about associativity of prefix ++ if ++++x is an
>> illegal expression.

>
> There is no "associativity" at all for unary operators. Associativity is
> a notion which is defined only for binary operators.


True. The equivalent for unary operators is probably distributivity, or
whatever it's called. Like how -(a+b) == (-a)+(-b). Although of course
-(a*b) != (-a)*(-b), so it's a bit more complicated. And not at all
related to drawing up tables of operators.

tom

--
hypnopomp rapist
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Looking for good table with all Java operators isakdp@gmail.com Java 0 11-13-2012 12:26 AM
Re: Looking for good table with all Java operators John B. Matthews Java 17 01-26-2010 04:28 PM
Is it a good practice to call the destructor explicitly and use placement new(this) in assignment operators? Michael Tsang C++ 8 12-14-2009 07:43 PM
Looking for a Good Sim to Practice on and a good book? Pat MCSA 2 03-29-2008 12:19 AM
Is this a good idea? (Error handling with overloaded operators) mike3 C++ 5 05-27-2007 12:44 AM



Advertisments