9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: erik quanstrom <quanstro@quanstro.net>
To: 9fans@9fans.net
Subject: Re: [9fans] subtracting pointers on amd64 6c
Date: Tue,  5 Jan 2016 12:40:25 -0800	[thread overview]
Message-ID: <aa7f7fb29934131780522e9bb3ad0b32@lilly.quanstro.net> (raw)
In-Reply-To: <CAOw7k5ijsx7Y5thQnfrx+F+rcYLBGYBfy3y20aDBOKdci48UHA@mail.gmail.com>

On Tue Jan  5 11:49:06 PST 2016, charles.forsyth@gmail.com wrote:

> On 5 January 2016 at 19:01, Devon H. O'Dell <devon.odell@gmail.com> wrote:
>
> > so given any of the examples in this thread, if you typedef'ed
> > ptrdiff_t to long, then the compiler technically isn't actually doing
> > anything wrong. whether it is doing something useful is a different
> > question.
> >
>
> Well, although I knew that was true, I didn't want to push the point because
> in practice, people have a right to expect certain reasonable behaviour,
> and it's quite reasonable to expect that p+(q-p) yields q if they both point
> into the same array that the system agreed to allocate somehow.
> It make sense to use 64 bits for the difference, and indeed the code
> block that adds the current cast has an if(1 && ...) suggesting an if(0 &&

yes!  this.  one thing i love about the plan 9 compilers is that my reasonable
expectations are not violated by some happy optimizer, or decision.

this gets us back to the op's pov

> i get that probably nobody cares about c standards here, but it might
> be useful to mention what c99 and c11 say about this issue, since the

which i think is wrong.  there is some current silliness with compilers that
conflates allowed with required and undefined with can be deleted.  i
see plan 9's decisions as rejecting this way of thinking.  however, this is
in no way anti-standard.

- erik



  reply	other threads:[~2016-01-05 20:40 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-05  6:36 cinap_lenrek
2016-01-05  7:53 ` cinap_lenrek
2016-01-05 10:17   ` Charles Forsyth
2016-01-05 10:15 ` Charles Forsyth
2016-01-05 10:28   ` Charles Forsyth
2016-01-05 19:01     ` Devon H. O'Dell
2016-01-05 19:46       ` Charles Forsyth
2016-01-05 20:40         ` erik quanstrom [this message]
2016-01-05 21:53           ` Devon H. O'Dell
2016-01-05 23:27             ` erik quanstrom
2016-01-05 23:37       ` Dave Eckhardt
2016-01-05 21:03     ` erik quanstrom
2016-01-05 22:32     ` cinap_lenrek
2016-01-05 22:57       ` Devon H. O'Dell
2016-01-05 23:17         ` Devon H. O'Dell
2016-01-05 23:14       ` erik quanstrom
2016-01-06  6:58       ` cinap_lenrek
2016-01-06 19:10         ` erik quanstrom
2016-01-07  1:08           ` cinap_lenrek
2016-01-08 22:23             ` erik quanstrom

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aa7f7fb29934131780522e9bb3ad0b32@lilly.quanstro.net \
    --to=quanstro@quanstro.net \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).