Click here to Skip to main content
15,902,492 members
Home / Discussions / C#
   

C#

 
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 
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 
Wjousts wrote:
i gets assigned 5 and then i gets incremented. Therefore i = 6.

That's not the normal execution order.
The real execution order (in C#) is:
Read value of i
Increment i
Assign old value of i to i

Why should the "++" wait until after the assignment? It directly binds to "i":
AssignmentExpression: Left=i Op=Assign Right=[UnaryExpression: Op=PostIncrement Expr=i]

It behaves differently in C++ because C++ has very strange rules for execution order.
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 
GeneralRe: Strange IL code from simple C# expression Pin
Dave Kreskowiak29-Sep-05 0:29
mveDave Kreskowiak29-Sep-05 0:29 
GeneralRe: Strange IL code from simple C# expression Pin
Dave Kreskowiak23-Sep-05 7:46
mveDave Kreskowiak23-Sep-05 7:46 
QuestionMachine Names on Network Pin
Greeky22-Sep-05 23:11
Greeky22-Sep-05 23:11 
AnswerRe: Machine Names on Network Pin
enjoycrack23-Sep-05 1:22
enjoycrack23-Sep-05 1:22 
QuestionWeb Link in RichTextBox Pin
Greeky22-Sep-05 22:31
Greeky22-Sep-05 22:31 
AnswerRe: Web Link in RichTextBox Pin
enjoycrack23-Sep-05 1:25
enjoycrack23-Sep-05 1:25 
QuestionStraming integer values Pin
Afief22-Sep-05 22:22
Afief22-Sep-05 22:22 
QuestionMultiple Q's, Answer as many as you like. Pin
Anthony Mushrow22-Sep-05 22:07
professionalAnthony Mushrow22-Sep-05 22:07 
AnswerRe: Multiple Q's, Answer as many as you like. Pin
Niklas Ulvinge23-Sep-05 0:45
Niklas Ulvinge23-Sep-05 0:45 

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.