[nem-en] incorrect side effect of ++ operator

Wiktor Zychla wzychla at vulcan.edu.pl
Mon Sep 27 16:34:51 CEST 2004


>Just do
>++i;
>Console.WriteLine( "{0}", i );

yes, I've found this solution by myself.

>> IMHO void should have no representation in runtime, because it just an 
>> alias
>> for saying "nothing was computed". And now runtime thinks, that instead
>> nothind, we have *null* computed, which is very strange.
>
> What else would you insert there?

no value left on stack could be an option,
so when you write:

  mutable i=0;
  Console.WriteLine( "{0}", ++i );

you get an error because the computation of "++i" does not left any value on 
stack.

returning the value 'null' from the computation that should not return any 
value is not intuitive in this case.

Wiktor 






More information about the devel-en mailing list