Click here to Skip to main content
15,886,919 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: what about x = x++; ? Pin
Anonymous15-Sep-05 8:38
Anonymous15-Sep-05 8:38 
GeneralRe: what about x = x++; ? Pin
bugDanny15-Sep-05 8:57
bugDanny15-Sep-05 8:57 
GeneralRe: what about x = x++; ? Pin
Chris Losinger15-Sep-05 8:59
professionalChris Losinger15-Sep-05 8:59 
GeneralRe: what about x = x++; ? Pin
bugDanny15-Sep-05 9:05
bugDanny15-Sep-05 9:05 
GeneralRe: what about x = x++; ? Pin
David Crow15-Sep-05 9:32
David Crow15-Sep-05 9:32 
GeneralRe: what about x = x++; ? Pin
pesho293215-Sep-05 21:02
pesho293215-Sep-05 21:02 
GeneralRe: what about x = x++; ? Pin
David Crow16-Sep-05 2:15
David Crow16-Sep-05 2:15 
GeneralRe: what about x = x++; ? Pin
bugDanny16-Sep-05 3:15
bugDanny16-Sep-05 3:15 
pesho2932 wrote:
I don't agree that

y = x + x++;

is defined.
As most of you will agree i guess, the compiler reserves the right to evaluate operands and function arguments in any order.


I suppose this could be true. It could be my fault in believing the writer I quoted in an earlier quote, Tony Gaddis, who said:

"Postfix mode causes the increment to happen after the value of the variable is used in the expression."

If Gaddis is right, then the increment happens after x is used in the expression x + x

But perhaps someone did think it would be funny to mess with this behavior in the compiler to screw us programmers up. I did find a few good quotes on the matter:

Argument is conclusive... but... it does not remove doubt, so that the mind may rest in the sure knowledge of the truth, unless it finds it by the method of experiment. For if any man who never saw fire proved by satisfactory arguments that fire burns. his hearer's mind would never be satisfied, nor would he avoid the fire until he put his hand in it that he might learn by experiment what argument taught.
Bacon, Roger
1214-1294 British Philosopher Scientist

It is not necessary to understand things in order to argue about them.
Beaumarchais, Pierre De
1732-1799 French Dramatist

Men's arguments often prove nothing but their wishes.
Colton, Charles Caleb
1780-1832 British Sportsman Writer

It is better to debate a question without settling it than to settle it without debate.
Joubert, Joseph
1754-1824 French Moralist

If you argue with a woman and win, you lose.
Unknown, Source

That last one doesn't really apply, but I thought it was a good quote.

Danny

-- modified at 9:18 Friday 16th September, 2005
GeneralRe: what about x = x++; ? Pin
pesho293216-Sep-05 3:36
pesho293216-Sep-05 3:36 
GeneralRe: what about x = x++; ? Pin
bugDanny16-Sep-05 4:19
bugDanny16-Sep-05 4:19 
GeneralRe: what about x = x++; ? Pin
pesho293218-Sep-05 21:48
pesho293218-Sep-05 21:48 
GeneralRe: what about x = x++; ? Pin
bugDanny19-Sep-05 3:02
bugDanny19-Sep-05 3:02 
GeneralRe: what about x = x++; ? Pin
pesho293219-Sep-05 5:38
pesho293219-Sep-05 5:38 
GeneralRe: what about x = x++; ? Pin
bugDanny19-Sep-05 7:43
bugDanny19-Sep-05 7:43 
GeneralRe: what about x = x++; ? Pin
pesho293219-Sep-05 21:14
pesho293219-Sep-05 21:14 
GeneralRe: what about x = x++; ? Pin
bugDanny20-Sep-05 3:16
bugDanny20-Sep-05 3:16 
GeneralRe: what about x = x++; ? Pin
pesho293220-Sep-05 4:52
pesho293220-Sep-05 4:52 
GeneralRe: what about x = x++; ? [Modified 2005-09-19] Pin
Maxwell Chen15-Sep-05 21:17
Maxwell Chen15-Sep-05 21:17 
GeneralRe: what about x = x++; ? Pin
bugDanny16-Sep-05 3:21
bugDanny16-Sep-05 3:21 
QuestionVC++6.0 - Finding users privileges Pin
Rainos15-Sep-05 4:48
Rainos15-Sep-05 4:48 
AnswerRe: VC++6.0 - Finding users privileges Pin
David Crow15-Sep-05 7:32
David Crow15-Sep-05 7:32 
GeneralRe: VC++6.0 - Finding users privileges Pin
Rainos15-Sep-05 21:49
Rainos15-Sep-05 21:49 
GeneralRe: VC++6.0 - Finding users privileges Pin
David Crow16-Sep-05 2:11
David Crow16-Sep-05 2:11 
GeneralRe: VC++6.0 - Finding users privileges Pin
Rainos16-Sep-05 2:49
Rainos16-Sep-05 2:49 
GeneralRe: VC++6.0 - Finding users privileges Pin
David Crow16-Sep-05 4:59
David Crow16-Sep-05 4:59 

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.