Consider this code:
struct Point {
double x;
double y;
double z;
void setByIndex(int i, double value) {
(&x)[i] = value;
}
};
The setByIndex()
function works and does what I want. But can I be sure this is not a UB (when called with a proper i
)? Could you please provide references to the standard with the explanation?