Click here to Skip to main content
16,005,141 members
Home / Discussions / C#
   

C#

 
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 
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 
Dave Kreskowiak wrote:
WHAT?! Then why have a language specification at all? They detail the inner workings of the instruction set and execution order.

Not relevant to this problem.
You are still not getting this. i++ is logically equavalent to i=i+1 correct? If i do i=i+1 I should get the same value in i as I would if I just did i++, correct? So then:
<br />
int i = 5;<br />
i = i++;<br />

should give the same result as:
<br />
int i = 5;<br />
i = i;<br />
i = i + 1;<br />

Correct? Therefore i should equal 6. Show me where the flaw is? Both the assignment and the increment have to happen before the code has finished executing therefore it really doesn't matter which one happens first.
Compare these:
<br />
int i = 5;<br />
i++;<br />
Console.Writeline(i.ToString());<br />


<br />
int i = 5;<br />
++i;<br />
Console.Writeline(i.ToString());<br />


What's the output in both cases? Would you agree that the postfix or prefix notation doesn't change the output in this case?
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 
QuestionCREATING AND DELETING DATABSE IN C# .NET Pin
EKJDBA22-Sep-05 22:05
EKJDBA22-Sep-05 22:05 
AnswerRe: CREATING AND DELETING DATABSE IN C# .NET Pin
sreejith ss nair23-Sep-05 2:19
sreejith ss nair23-Sep-05 2:19 

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.