[nem-en] Increment and decrement operators

Kamil Skalski kamil.skalski at gmail.com
Sun Feb 26 11:52:48 CET 2006


2006/2/26, Sergei Tulentsev <sergei.tulentsev at gmail.com>:
> On 2/26/06, Kamil Skalski <kamil.skalski at gmail.com> wrote:
> > They would return value as expected from ++  / -- in C.
> >
> > What do you think, would it be nice to have by default or not?
>
> Yes, I guess, there is no threat if they will return value. And it
> will be more intuitive for people with C-family background.
>

To make it clear: I'm thinking about adding new operators '+++' and
'---', which would return values. Existing '++' and '--' would remain
the same - they do not return value for purpose:
if you have code like

foo ();
++i;
bar ();
..

it is better to keep it like this and still do not get the warning
about ignored value (returned by ++i)

On the other hand, having ++ behave as expected by many would be very
nice - maybe we should have a special case for ++ and -- so that they
will return void in general, but if expected some value, they will
return it...

--
Kamil Skalski
http://nazgul.omega.pl


More information about the devel-en mailing list