UB or not UB?

A place for Ogre users to discuss non-Ogre subjects with friends from the community.
User avatar
AlexeyKnyshev
Goblin
Posts: 213
Joined: Sat May 26, 2012 10:37 am
Location: Russia
x 13

UB or not UB?

Post by AlexeyKnyshev »

Is it undefined behavior?

Code: Select all

int i = 1;
i = i++ + ++i; 
printf("%d", i);
p.s. I'm sure about UB in " i = ++i + ++i; "
Voltage Engine - boost your ogre project with realtime physics and interactive scripting!
OgreBullet & CMake - easy to use bullet physics integration.
User avatar
saejox
Goblin
Posts: 260
Joined: Tue Oct 25, 2011 1:07 am
x 36

Re: UB or not UB?

Post by saejox »

Even 'i = i++' is undefined.
There is a nice wiki article about it:
http://en.wikipedia.org/wiki/Sequence_point
Nimet - Advanced Ogre3D Mesh/dotScene Viewer
asPEEK - Remote Angelscript debugger with html interface
ogreHTML - HTML5 user interfaces in Ogre