On Friday, June 22, 2012 2:34:58 PM UTC+1, Ben Bacarisse wrote:
> "BartC" <> writes:
<snip>
> I've never liked the view that anything can happen with undefined code;
> it sounds too much like a cheap pedagogical trick to say that the above
> could format your drive.
a poster on here used to claim he'd seen a system pop up the old DOS dialog box saying "Are You Sure You Want To Reformat C

". For some sort of UB (not tricks with ++ but (I think) some sort of out of bounds thing).
> But the other extreme -- we all know what
> *should* happen, don't we? -- is equally unconvincing. When the C
> language does not define the meaning of a bit of code, something else
> does, and that's enough for me. I don't want to write code whose
> meaning is in the hands of unknown entities. This point of view covers
> the much more significant case where I *know* what entity will define
> the meaning of otherwise undefined code -- POSIX, for example.
I've seen program behaviour change due to UB when a compiler was upgraded (same manufacturer). Changing optimisation can do it too.
<snip>