mercredi 21 décembre 2016

Swapping array name and index

Older compilers allowed this kind of "blasphemy"

int a[5];
4[a] = 3;

Simply because operator[] would allow const expression and those are equal:

*(4 + a) === *(a + 4)

Is that a defined behavior or an UB in C++11?

Aucun commentaire:

Enregistrer un commentaire