Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #91466

Re: Question

X-Received by 10.107.141.78 with SMTP id p75mr46750297iod.12.1470053969005; Mon, 01 Aug 2016 05:19:29 -0700 (PDT)
X-Received by 10.157.5.98 with SMTP id 89mr3262456otw.9.1470053968978; Mon, 01 Aug 2016 05:19:28 -0700 (PDT)
Path csiph.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!news.glorb.com!f6no6439179ith.0!news-out.google.com!d130ni21434ith.0!nntp.google.com!f6no6439173ith.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups comp.lang.c
Date Mon, 1 Aug 2016 05:19:28 -0700 (PDT)
In-Reply-To <c2aa5c4d-cbf3-242a-f760-a654cf033d19@verizon.net>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=2602:306:bcf3:c090:9d0d:2e2e:4e4f:84e8; posting-account=gVUFUgoAAABnx6r1g-WW77Xxu1tITTN0
NNTP-Posting-Host 2602:306:bcf3:c090:9d0d:2e2e:4e4f:84e8
References <nnd8ue$nnp$2@dont-email.me> <nndoie$ip1$1@dont-email.me> <c2aa5c4d-cbf3-242a-f760-a654cf033d19@verizon.net>
User-Agent G2/1.0
MIME-Version 1.0
Message-ID <e7444e89-94de-4db0-9992-9ec8976d6262@googlegroups.com> (permalink)
Subject Re: Question
From supercat@casperkitty.com
Injection-Date Mon, 01 Aug 2016 12:19:29 +0000
Content-Type text/plain; charset=UTF-8
Xref csiph.com comp.lang.c:91466

Show key headers only | View raw


On Saturday, July 30, 2016 at 1:46:01 PM UTC-5, James R. Kuyper wrote:
> Tim Rentsch notified me by e-mail of a point I got wrong in that 
> explanation: while a character type can be used to alias a pointer type, 
> the reverse is not true. I even discussed this issue recently (with 
> supercat@casperkitty.com?), yet I still forgot about it. The reason in 
> this case isn't tiredness, but the fact that I find this asymmetry in 
> the anti-aliasing rules counter-intuitive. If an array of character type 
> is sufficiently long, correctly aligned (which is easier to arrange in 
> C2011 (using _Alignas()) than it was in older versions of C, and does 
> not contain a trap representation for the aliasing type, it seems to me 
> that you should be permitted to alias it - but the C standard only 
> allows aliasing in the other direction.

I've seen no reason to believe that the asymmetry was intended with
regard to character arrays, which can of course only be accessed with
(wait for it)...

   ** pointers to character types **

Any workable set of aliasing rules would be a fair bit longer than the
rules in C89, and the authors of the Standard almost certainly expected
that any quality compiler would recognize aliasing in the cases where it
is obvious.  While it would have been odd to omit the case where an
object of its exact type, I think their real interest was ensuring that
all compilers would recognize certain cases *beyond* those where it would
be obvious--those where pointers differ only by qualifiers or signedness,
or where things were accessed via character pointer.

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Question DFS <nospam@dfs.com> - 2016-07-28 11:38 -0400
  Re: Question Melzzzzz <mel@zzzzz.com> - 2016-07-28 17:50 +0200
  Re: Question BartC <bc@freeuk.com> - 2016-07-28 17:49 +0100
    Re: Question Melzzzzz <mel@zzzzz.com> - 2016-07-28 18:52 +0200
    Re: Question Keith Thompson <kst-u@mib.org> - 2016-07-28 11:58 -0700
      Re: Question BartC <bc@freeuk.com> - 2016-07-28 20:57 +0100
  Re: Question "D. Aaron Sawyer" <aaron@110.net> - 2016-07-28 13:55 -0300
  Re: Question Barry Schwarz <schwarzb@dqel.com> - 2016-07-28 11:38 -0700
    Re: Question DFS <nospam@dfs.com> - 2016-07-28 15:20 -0400
    Re: Question Tim Rentsch <txr@alumni.caltech.edu> - 2016-07-30 09:24 -0700
  Re: Question Ian Collins <ian-news@hotmail.com> - 2016-07-29 07:23 +1200
  Re: Question James Kuyper <jameskuyper@verizon.net> - 2016-07-28 16:05 -0400
    Re: Question DFS <nospam@dfs.com> - 2016-07-29 10:14 -0400
    Re: Question "James R. Kuyper" <jameskuyper@verizon.net> - 2016-07-30 14:45 -0400
      Re: Question supercat@casperkitty.com - 2016-08-01 05:19 -0700
  Re: Question Tim Rentsch <txr@alumni.caltech.edu> - 2016-07-30 09:17 -0700

csiph-web