Path: csiph.com!news.swapon.de!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: Equal yet different pointers Date: Thu, 16 Nov 2017 09:33:32 -0800 Organization: None to speak of Lines: 25 Message-ID: <87a7zmyvpv.fsf@kst-u.example.com> References: <87k1yqyxgx.fsf@kst-u.example.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: reader02.eternal-september.org; posting-host="c0732fd20b87a32d7f44c84be981d0b2"; logging-data="29287"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18+lRePsRISN+DlYNlqf4DL" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) Cancel-Lock: sha1:Kn+adstFN36xXZKRRjRaVdiPh6E= sha1:3oTIlFXucRVFwVNUJKucG8Dc63c= Xref: csiph.com comp.lang.c:122731 Spiros Bousbouras writes: > On Thu, 16 Nov 2017 08:55:42 -0800 > Keith Thompson wrote: [...] >> Why do you expect a warning? There may or may not be undefined >> behavior, but as far as I can tell no diagnostic is required. >> >> For example, >> int *p = &i = 1; > > ^ > + instead of = Yes, thank you. >> is valid; the object i can be treated as a single element array, and p >> points just past the end of it. Normally dereferencing p would have >> undefined behavior (which a compiler could detect only if it does data >> flow analysis). -- Keith Thompson (The_Other_Keith) kst-u@mib.org Working, but not speaking, for JetHead Development, Inc. "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"