[Showerthought] c>c++ is actually true.
int main(int,char*[]) {
int c=0;
if(c>c++)
std::cout << "Ooops UB!" <<std::endl;
return 1;
}
So much for c++ being bigger than c.
Petition to rename c++ to ++c.
Edit: It has been pointed out to me that this is UB based on the order of evaluation rules. However, I'll leave the post so others can learn from my shame. (Thank you to u/HappyFruitTree and u/TheSuperWig)
Posted Oct 7, 2020, 10:47 AM UTC · edited
It's undefined behaviour.
Is it? Based on what rule?
The sequenced-before rules (C++11 or later) or the sequence point rules (before C++11).
Ah well. You are right. The Standard Comittee has beaten me again.
I like the "Ooops UB!" edit.
Evaluation order
https://en.cppreference.com/w/cpp/language/eval_order