Hacker News new | past | comments | ask | show | jobs | submit login

What an annoying post. Talks like he knows a lot, when he doesn't know this most basic of basic points of how C works. It's understandable to not know everything, even to have the odd hole in your basics like this. But the know-it-all voice (and for such a basic topic) "I explained operator precedence..." is just going to make you someone nobody wants to work with. This is not undefined behavior, it's one of the first things you learn about C after encountering the pre/postfix operators IF you pay attention to the details, which, with C, you should know to do.



> This is not undefined behavior, it's one of the first things you learn about C after encountering the pre/postfix operators IF you pay attention to the details, which, with C, you should know to do.

What exactly is not undefined behavior? The post describes a statement where a variable is modified multiple times between sequence points. What does the standard say about this?

N1256, 6.5 says

  Between the previous and next sequence point an object
  shall have its stored value modified at most once by the
  valuation of an expression.
J.2 Undefined behavior

  The behavior is undefined in the following circumstances:
  [..]
  * Between two sequence points, an object is modified more
    than once, or is modified and the prior value is read
    other than to determine the value to be stored (6.5).
What's with the know-it-all voice?


It's a common stylistic choice. Exaggerate how arrogant and smart you thought you were, only for it to be pricked by reality, end up humbled.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: