#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
uint32_t func() { return rand() % 10; }
struct A {
uint32_t _x, _y, _z;
A(uint32_t x, uint32_t y, uint32_t z) : _x(x), _y(y), _z(z) {}
};
int main() {
A a{func(), func(), func()};
//A a(func(), func(), func());
printf("%d %d %d\n", a._x, a._y, a._z);
return 0;
}
GCC 9.1 and MSVC 19.22.27905 will both print a different order when using curly braces or parentheses. Clang 8.0.0 will print the same order for both cases.
I can´t find anything in the standard about it, is it in the standard or is it up to the compiler which orders it evaluates the input argument?
Aucun commentaire:
Enregistrer un commentaire