top | item 45073860

(no title)

atiedebee | 6 months ago

What does he actually mean by this? I've dabbled in C's specification and weird behaviour on multiple occasions but I have no clue what he is referring to.

discuss

order

pjmlp|6 months ago

It has to do with the underflow and overflow rules, they are different between signed and unsigned integers, in regards to optimization freedom by the compilers.

spacechild1|6 months ago

Also, the promotion rules for mixing signed and unsigned numbers are pretty complex. It's very easy to make mistakes, sometimes with catastrophic results (e.g. negative numbers turning into huge positive number)