logoalt Hacker News

HarHarVeryFunnytoday at 12:11 AM2 repliesview on HN

It's only the order of evaluation that is undefined.


Replies

_kst_today at 12:58 AM

No, the behavior is undefined. That means, quoting the ISO C standard, "behavior, upon use of a nonportable or erroneous program construct or of erroneous data, for which this document imposes no requirements".

A conforming implementation could reject it at compile time, or generate code that traps, or generate code that set a to 137, or, in principle, generate code that reformats your hard drive. Some of these behaviors are unlikely, but none are forbidden by the language standard.

afdbcreidtoday at 12:43 AM

Nope, there is no sequence point in the middle and modifying an object more than once between sequence points is undefined behavior.