Categories
Mastering Development

Do the multiple postfix-expression(subscripting) evaluations result in UB

#include <iostream> int main(){ int arr[7] = {0,1,2,3,4,3,2}; arr[0]++[arr]++[arr]++[arr]++[arr]++[arr]++[arr] = 5; //#1 for(auto i = 0;i<7;i++){ std::cout<<i<<" : "<< arr[i]<<std::endl; } } Consider the above code, Is this evaluation at #1 would result in UB? This is a example I have saw in twitter. According to the evaluation sequence for postfix ++: expr.post.incr#1 The value […]