Does the following initializations of valueA and valueB entail undefined behavior?
int array[2] = {1,2};
int index = 0;
int valueA = array[index++], valueB = array[index++];
Is there any change in this between c++ 98 and c++ 11?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The behavior is well-defined. From C++11 draft n3290 §8 Declarators:
So your code is equivalent to:
I don’t have a C++98 standard, but the same wording is present in ISO/IEC 14882:2003 (“C++03”).