On Wed, 2021-04-21 at 21:40 +0200, Stefan Ring wrote: > On Wed, Apr 21, 2021 at 8:41 PM Xi Ruoyao via Gcc-help > <gcc-help@xxxxxxxxxxx> wrote: > > > > I sincerely don't like to see someone try to "learn" by running some > > program containing "i = i++ + i++" and "inspect" the output. > > Nothing wrong with that! I did almost exactly this in the early > nineties on DOS, with 16-bit Borland C++ ;) > > But now I see what you're getting at. I understand the > assembly/machine code as output. But you were probably talking about > the result of the calculation. Well, even the asm/machine code can't be relied on. As it is an UB the compiler can output some really strange thing, maybe: incl %eax incl %eax addl %eax, %eax or incl %eax addl %eax, %eax incl %eax or addl %eax, %eax addl %eax, $2 or ud2 # you are invoking UB and breaking world peace! - by gcc Maybe the only "meaningful output" is: > test.c:6:4: warning: operation on 'i' may be undefined [-Wsequence- > point] (I think you absolutely understand what I posted above, but I'll still post it to warn new learners :) -- Xi Ruoyao <xry111@xxxxxxxxxxxxxxxx> School of Aerospace Science and Technology, Xidian University