Click here to Skip to main content
15,901,205 members
Home / Discussions / Managed C++/CLI
   

Managed C++/CLI

 
GeneralRe: MDB databases question Pin
Dash_12526-Dec-06 21:19
Dash_12526-Dec-06 21:19 
Questionpostfix increment c++ question Pin
swjam21-Dec-06 16:38
swjam21-Dec-06 16:38 
AnswerRe: postfix increment c++ question Pin
bsaksida21-Dec-06 22:10
bsaksida21-Dec-06 22:10 
QuestionRe: postfix increment c++ question Pin
prasad_som21-Dec-06 23:29
prasad_som21-Dec-06 23:29 
AnswerRe: postfix increment c++ question Pin
bsaksida22-Dec-06 0:26
bsaksida22-Dec-06 0:26 
AnswerRe: postfix increment c++ question Pin
prasad_som22-Dec-06 0:39
prasad_som22-Dec-06 0:39 
AnswerRe: postfix increment c++ question Pin
prasad_som21-Dec-06 22:26
prasad_som21-Dec-06 22:26 
AnswerRe: postfix increment c++ question Pin
John R. Shaw21-Dec-06 23:07
John R. Shaw21-Dec-06 23:07 
Very close.

This is the C equivalent of what the Microsoft compiler produces:

x = 20; y = 35;

x = y + x; // 35 + 20 = 55
x = x+1; // 56
y = y+1; // 36

y = y+1; // 37
x = x+1; // 57
y = y + x; // 94

I would like to note that you should not write code like "y = y++ + x++" because the results are undefined by the language. That is the results of a statement like "x = x++" is considered undefined and it is up to the compiler vendor to decide how to implement it.

The following C equivalent code may be produce by a different compiler:

x = 20; y = 35;

tx = x+1; // 21
ty = y+1; // 36
x = y + x; // 35 + 20 = 55
x = tx; // 21 (unexpected result)
y = ty; // 36

y = y+1; // 37
x = x+1; // 22
y = y + x; // 59

One other thing I would like to point out is that other languages, that have the '++' operator, interpret it differently.

For furthur information, try searching the Net for "i=i++".


INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
AnswerRe: postfix increment c++ question Pin
Christian Graus22-Dec-06 12:54
protectorChristian Graus22-Dec-06 12:54 
QuestionDifference in settings on laptop and destop, VC++.net 2003 Pin
minad_78621-Dec-06 2:34
minad_78621-Dec-06 2:34 
AnswerRe: Difference in settings on laptop and destop, VC++.net 2003 Pin
led mike21-Dec-06 4:54
led mike21-Dec-06 4:54 
Questioncan anybody tell me where ....? Pin
Banks K21-Dec-06 1:35
Banks K21-Dec-06 1:35 
AnswerRe: can anybody tell me where ....? Pin
led mike21-Dec-06 4:46
led mike21-Dec-06 4:46 
QuestionValue classes and structs Pin
kristmun20-Dec-06 21:47
kristmun20-Dec-06 21:47 
AnswerRe: Value classes and structs Pin
led mike21-Dec-06 4:50
led mike21-Dec-06 4:50 
QuestionConverting a IntPtr to HWND ? Pin
Fritzables20-Dec-06 17:08
Fritzables20-Dec-06 17:08 
AnswerRe: Converting a IntPtr to HWND ? Pin
User 58385220-Dec-06 18:38
User 58385220-Dec-06 18:38 
GeneralRe: Converting a IntPtr to HWND ? Pin
Fritzables21-Dec-06 10:41
Fritzables21-Dec-06 10:41 
QuestionPassing Reference to Thread Delegate Pin
ricecake20-Dec-06 8:54
ricecake20-Dec-06 8:54 
QuestionDispatching based on Names Pin
ComplexLifeForm19-Dec-06 21:33
ComplexLifeForm19-Dec-06 21:33 
AnswerRe: Dispatching based on Names Pin
bsaksida19-Dec-06 22:16
bsaksida19-Dec-06 22:16 
GeneralRe: Dispatching based on Names Pin
ComplexLifeForm20-Dec-06 0:15
ComplexLifeForm20-Dec-06 0:15 
AnswerRe: Dispatching based on Names Pin
led mike20-Dec-06 4:46
led mike20-Dec-06 4:46 
QuestionReading & Writing Config Files Pin
mactick19-Dec-06 20:36
mactick19-Dec-06 20:36 
AnswerRe: Reading & Writing Config Files Pin
bsaksida19-Dec-06 22:21
bsaksida19-Dec-06 22:21 

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.