Click here to Skip to main content
15,917,174 members
Home / Discussions / C#
   

C#

 
GeneralRe: Strange IL code from simple C# expression Pin
Andrew Kirillov23-Sep-05 1:13
Andrew Kirillov23-Sep-05 1:13 
AnswerRe: Strange IL code from simple C# expression Pin
User 665823-Sep-05 1:26
User 665823-Sep-05 1:26 
GeneralRe: Strange IL code from simple C# expression Pin
Andrew Kirillov23-Sep-05 1:27
Andrew Kirillov23-Sep-05 1:27 
AnswerRe: Strange IL code from simple C# expression Pin
sreejith ss nair23-Sep-05 2:37
sreejith ss nair23-Sep-05 2:37 
GeneralRe: Strange IL code from simple C# expression Pin
Andrew Kirillov23-Sep-05 2:41
Andrew Kirillov23-Sep-05 2:41 
GeneralRe: Strange IL code from simple C# expression Pin
sreejith ss nair23-Sep-05 2:44
sreejith ss nair23-Sep-05 2:44 
AnswerRe: Strange IL code from simple C# expression Pin
leppie23-Sep-05 3:01
leppie23-Sep-05 3:01 
AnswerRe: Strange IL code from simple C# expression Pin
Dave Kreskowiak23-Sep-05 5:55
mveDave Kreskowiak23-Sep-05 5:55 
GeneralRe: Strange IL code from simple C# expression Pin
Andrew Kirillov23-Sep-05 6:26
Andrew Kirillov23-Sep-05 6:26 
GeneralRe: Strange IL code from simple C# expression Pin
Wjousts23-Sep-05 6:45
Wjousts23-Sep-05 6:45 
GeneralRe: Strange IL code from simple C# expression Pin
Andrew Kirillov23-Sep-05 6:55
Andrew Kirillov23-Sep-05 6:55 
GeneralRe: Strange IL code from simple C# expression Pin
Wjousts23-Sep-05 8:56
Wjousts23-Sep-05 8:56 
GeneralRe: Strange IL code from simple C# expression Pin
Dave Kreskowiak23-Sep-05 9:17
mveDave Kreskowiak23-Sep-05 9:17 
GeneralRe: Strange IL code from simple C# expression Pin
Wjousts23-Sep-05 9:30
Wjousts23-Sep-05 9:30 
No, I think it is a bug, evaulation rules or not. It's very easy to miss (and I did at first) but the prefix/postfix thing is irrelevant:

<br />
int i = 5;<br />
i = i++;<br />


versus

<br />
int i = 5;<br />
i = ++i;<br />


Should both end up with i = 6. i++ is the same as i = i + 1 (so is ++i) so really the both code snippets should become

<br />
int i = 5;<br />
i = i;<br />
i = i + 1;<br />


and

<br />
int i = 5;<br />
i = i + 1;<br />
i = i;<br />


It shouldn't matter if you do i = i first or i = i + 1 first the result should still be six.
As somebody else pointed out, it you do j = i++ then look at the value of j then the prefix/postfix part matters, but because you are putting the result back in to i it should be six either way.
GeneralRe: Strange IL code from simple C# expression Pin
Dave Kreskowiak23-Sep-05 16:58
mveDave Kreskowiak23-Sep-05 16:58 
GeneralRe: Strange IL code from simple C# expression Pin
Wjousts24-Sep-05 3:33
Wjousts24-Sep-05 3:33 
GeneralRe: Strange IL code from simple C# expression Pin
Daniel Grunwald24-Sep-05 21:44
Daniel Grunwald24-Sep-05 21:44 
GeneralRe: Strange IL code from simple C# expression Pin
Dave Kreskowiak25-Sep-05 1:37
mveDave Kreskowiak25-Sep-05 1:37 
GeneralRe: Strange IL code from simple C# expression Pin
Wjousts25-Sep-05 3:29
Wjousts25-Sep-05 3:29 
GeneralRe: Strange IL code from simple C# expression Pin
Dave Kreskowiak26-Sep-05 1:20
mveDave Kreskowiak26-Sep-05 1:20 
GeneralRe: Strange IL code from simple C# expression Pin
Wjousts26-Sep-05 6:10
Wjousts26-Sep-05 6:10 
GeneralRe: Strange IL code from simple C# expression Pin
Dave Kreskowiak26-Sep-05 13:57
mveDave Kreskowiak26-Sep-05 13:57 
GeneralRe: Strange IL code from simple C# expression Pin
Wjousts26-Sep-05 23:21
Wjousts26-Sep-05 23:21 
GeneralRe: Strange IL code from simple C# expression Pin
Dave Kreskowiak27-Sep-05 14:25
mveDave Kreskowiak27-Sep-05 14:25 
GeneralRe: Strange IL code from simple C# expression Pin
Wjousts28-Sep-05 15:35
Wjousts28-Sep-05 15:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.