top | item 30552846

(no title)

pascal_cuoq | 4 years ago

Yes, the first two examples in the article weren't obviously enough undefined for the authors of CIL who wrote the list, apparently.

discuss

order

Liquid_Fire|4 years ago

Does the first example contain undefined behaviour? (As written it does because x is not initialised, but the text suggests that a value is actually being provided for x)

I think the second example may contain UB on a <=32-bit architecture (right shift by a value greater or equal to the number of bits), or at least this is UB in C++. On a 64-bit architecture it would be fine (but the result would not be 0).