Greg Stein wrote:
> 
> On Mon, Mar 11, 2002 at 11:55:07AM +0100, Sander Striker wrote:
> > 1) Can we decide on a standard style when it comes to using
> >    ++ or --?
> >
> >    Example:
> >
> >    lines++;
> >
> >    vs.
> >
> >    ++lines;
> 
> I prefer the latter. The first thing your eye sees is the increment, then
> the variable. The *operation* is first, which is the most important.

I'm very bad in styling, but I absolutely agree.

++something is simpler:

1. Increment "something".
2. Use the result (in case it is a part of a bigger expression).

While something++ is more complicated:

1. Keep the original value of "something".
2. Increment "something".
3. Use the original value, which was kept by rule #1 (in case it is a
   part of a bigger expression).

Although under most hardware architectures, both expressions are
compiled into the same number of instructions (even in case it is a
part of a bigger expression), ++something should be the default, unless
you specifically need something++.

But again: I'm bad in styling, so this is only my humble opinion...
And the whole issue is really minor...

-- 
Eli Marmor
[EMAIL PROTECTED]
CTO, Founder
Netmask (El-Mar) Internet Technologies Ltd.
__________________________________________________________
Tel.:   +972-9-766-1020          8 Yad-Harutzim St.
Fax.:   +972-9-766-1314          P.O.B. 7004
Mobile: +972-50-23-7338          Kfar-Saba 44641, Israel

Reply via email to