Is double pre-incrementing undefined behavior? Like ++++x or even ++++++++x. I think it must be since it all occurs between sequence points. But what could possibly go wrong? Or do you just not ask that question and automatically stay away from any undefined operations? Is double incrementing ever routinely used? Thanks.
MandrewP 60 Junior Poster in Training
Recommended Answers
Jump to PostIt is undefined behavior because the compiler is not required to perform the increments in any specific order.
Jump to PostI think it must be since it all occurs between sequence points.
Sequence point rules were there prior to C++11. Now, those rules have been superceded by sequenced-before rules.
The question: does
i++ + ++i;
engender undefined behaviour is of relevance if and only ifi
…
All 5 Replies
mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster
deceptikon 1,790 Code Sniper Team Colleague Featured Poster
David W 131 Practically a Posting Shark
vijayan121 1,152 Posting Virtuoso
shahid_650 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.