-----------------------------------------------------------

New Message on MumbaiUserGroup

-----------------------------------------------------------
From: nilesh_m
Message 11 in Discussion

Dear All,   Have a look at the code-snippet attached for your reference. I don't think 
so this is a bug. In fact you'll notice similar behaviour with Perl, Java as well. 
Anyway I'm not here to debate on whether it's a bug or not.   Have provided two 
code-snippets along with the section of MSIL code for your reference.   Cheers   
Nilesh   using System; class Test1
{
  public static void Main() 
  {
   int i = 0;
 i = i++; 
 Console.WriteLine("Value of i is {0}", i);
  } } /*
  IL_0000:  ldc.i4.0  // Push 0 (integer zero) on stack
  IL_0001:  stloc.0   // Pop from stock; [this assigns zero to i]
  IL_0002:  ldloc.0   // Push i (value) on stack; [old value required for expression 
involving postfix]
  IL_0003:  dup    // Push on stack whatever was the latest value on stack; [for 
post-fix]
  IL_0004:  ldc.i4.1  // Push 1 (integer 1) on stack; [for post-fix]
  IL_0005:  add    // Pop last two values from stack; add them and push result on 
stack; [for post-fix]
  IL_0006:  stloc.0   // Pop from stock; [this assigns incremented value to i]
  IL_0007:  stloc.0   // Pop from stock; [this assigns result of expression to 
left-hand side]
*/
   using System; class Test1
{
  public static void Main() 
  {
   int i = 0;
 i = i++ + i; 
 Console.WriteLine("Value of i is {0}", i);
  } } /*
  IL_0000:  ldc.i4.0  // Push 0 (integer zero) on stack
  IL_0001:  stloc.0   // Pop from stock; [this assigns zero to i]
  IL_0002:  ldloc.0   // Push i (value) on stack; [old value required for expression 
involving postfix]
  IL_0003:  dup    // Push on stack whatever was the latest value on stack; [for 
post-fix]
  IL_0004:  ldc.i4.1  // Push 1 (integer 1) on stack; [for post-fix]
  IL_0005:  add    // Pop last two values from stack; add them and push result on 
stack; [for post-fix]
  IL_0006:  stloc.0   // Pop from stock; [this assigns incremented value to i]
  IL_0007:  ldloc.0   // Push i (value) on stack as expression i++ + i
  IL_0008:  add    // Pop last two values from stack; add them and push result on 
stack; 
  IL_0009:  stloc.0   // Pop from stock; [this assigns result of expression to 
left-hand side]
*/
View Attachment(s):
http://groups.msn.com/mumbaiusergroup/_notifications.msnw?type=msg&mview=1&parent=1&item=4500
-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/mumbaiusergroup/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you received 
this message by mistake, please click the "Remove" link below. On the pre-addressed 
e-mail message that opens, simply click "Send". Your e-mail address will be deleted 
from this group's mailing list.
mailto:[EMAIL PROTECTED]

Reply via email to