I have to build a LPoint3f
with 3 arguments which are the result of dgi.get_int32() / 100.0
. In Python I can rely on the calling order:
LPoint3f(dgi.get_int32() / 100.0, dgi.get_int32() / 100.0, dgi.get_int32() / 100.0);
# values are correct
When translating this code to C++
I wrote:
LPoint3f pos(dgi.get_int32() / 100.0, dgi.get_int32() / 100.0, dgi.get_int32() / 100.0);
// incorrect values sometimes, correct others
However, this works:
x = dgi.get_int32() / 100.0;
y = dgi.get_int32() / 100.0;
z = dgi.get_int32() / 100.0;
LPoint3f pos(x, y, z);
Is code #1 undefined behavior?