I also have the habit in C of writing 0==var rather than var==0.
The two expressions have no syntactic or semantic differences.

I acquired the habit from APL and J where the right-to-left 
syntax favors having "simpler" expressions on the left.  e.g.
I would favor
   (2*a) %~ (*:b) (+,-) 4*a*c
over
   ((*:b) (+,-) 4*a*c) % 2*a
Long scope parens break my train of thought (already too
short as it is).



----- Original Message -----
From: Dan Bron <[EMAIL PROTECTED]>
Date: Friday, February 29, 2008 10:38
Subject: Re: [Jprogramming] boxed data manipulation
To: Programming forum <[email protected]>

> Devon wrote:
> >  I do this (A;<B) customarily as well because I've 
> been 
> >  surprised too many times doing it the simpler (usually 
> >  equivalent) way.
> 
> I have a similar habit of preferring  @:  to  
> @  . 
> 
> 
> >  It's like the good habit of doing comparisons
> >  in the order "constant=expression", as in 
> >  "if( 0==var)...", in C.
> 
> 
> Is this because you'll sometimes forget the second  =  
> and inadvertantly re-assign the variable?  Or are there 
> actually specified situations in C where  if (0 == 
> var)  can differ from  if (var == 0)  ?  Is 
> it some kind of precedence issue when parsing more complex 
> expressions?
> -Dan
> 
> -----------------------------------------------------------------
> -----
> For information about J forums see http://www.jsoftware.com/forums.htm
> 
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to