I read this answer about undefined behaviour, where I saw following statement:
++++++i; // UB, parsed as (++(++(++i)))
I don't think it is undefined behaviour. I have a doubt, Is it really UB in C++? If yes, then How?
Also, I made program and compiled using g++ prog.cpp -Wall -Wextra -std=gnu++1z -pedantic
command, it's working fine without any warning. It's give an expected output.
#include <iostream>
using namespace std;
int main()
{
int i = 0;
cout<<++++++i<<endl;
}
Aucun commentaire:
Enregistrer un commentaire