Path: csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Rainer Weikusat Newsgroups: comp.unix.programmer Subject: Re: Odd compiler behaviour? Date: Tue, 01 Mar 2016 22:09:48 +0000 Lines: 29 Message-ID: <87io15luj7.fsf@doppelsaurus.mobileactivedefense.com> References: <20160301061135.783@kylheku.com> <87h9gqb0lj.fsf@mantic.terraraq.uk> <878u22aua9.fsf@mantic.terraraq.uk> <87wpplaojy.fsf@mantic.terraraq.uk> <87si09lwsy.fsf@doppelsaurus.mobileactivedefense.com> <20160301135716.611@kylheku.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: individual.net cGoVP6wN1qqt5/WxLJYrwAAi/0/+zSPDfJ/f7EyBszVvH0e1A= Cancel-Lock: sha1:T64LxKhJsCqIGLCLQ2sdHMyIopE= sha1:dmRRuzEsulPGA2g1/nn/a5L5jFI= User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) Xref: csiph.com comp.unix.programmer:7994 Kaz Kylheku <330-706-9395@kylheku.com> writes: > ["Followup-To:" header set to comp.unix.programmer.] > On 2016-03-01, Rainer Weikusat wrote: >> Richard Kettlewell writes: >>> Barry Margolin writes: >> >> [...] >> >>>> Wow, you totally misunderstand the point of declaring out-of-bounds >>>> access to be UB. >>>> >>>> The compiler can still generate the first code, and in fact that's >>>> what I'd expect most compilers to do. It doesn't have to check >>>> bounds, >>> >>> “Do anything you like” - in other words, undefined behavior - includes >>> the first line, but not exclusively. >> >> "Nobody's asked to do anything specific" ('undefined behaviour') is >> something rather different fromj "do anything you like". > > "undefined behavior" is different from "nobody's asked to do anything > specific". It means "ISO C hasn't asked to do anything specific" > not necessarily "nobody". I meant "nobody is asked" which should probably have been "nobody was asked" and the "ISO-C" ought to have been obvious from the context (although the statement is not correct without it).