9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: "Devon H. O'Dell" <devon.odell@gmail.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] subtracting pointers on amd64 6c
Date: Tue,  5 Jan 2016 15:17:27 -0800	[thread overview]
Message-ID: <CAFgOgC9OutCWXOX-u1=gvytYUt8N8b3rBQQ25kjELg2jazYwoQ@mail.gmail.com> (raw)
In-Reply-To: <CAFgOgC_2-RcO1oqRSj-ANzXMxo-8Zdx8ZH+oz9cg8jMmtOSEuw@mail.gmail.com>

2016-01-05 14:57 GMT-08:00 Devon H. O'Dell <devon.odell@gmail.com>:
> 2016-01-05 14:32 GMT-08:00  <cinap_lenrek@felloff.net>:
>>> there are usable ANSI formats for the difference and sizeof types.
>>
>> so one would write %td instead of %ld for ptrdiff type? that seems
>> easy.
>
> yes, and there's support for u/i/o/X/x/etc modifiers
>
>> i'm not so sure how usize/ssize would work. %zud and %zd? or would
>> the z flag imply unsigned? would the return type of sizeof() also
>> become usize?
>
> it depends on what you are trying to target. that's why i bring up
> standards as soon as you start talking about this. size_t and
> ptrdiff_t are part of C. ssize_t isn't.
>
> ssize_t is a posix-ism and is defined to store "values at least in the
> range [-1, {SSIZE_MAX}]". If you care about what C says, then you can
> do anything you want with ssize, because it isn't part of C. For
> printing, %zu is size_t (per C) and %zd is ssize_t (per POSIX).

I'm wrong here, %z is for size_t in general (plus modifiers including d).

> --dho
>
>> --
>> cinap
>>



  reply	other threads:[~2016-01-05 23:17 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
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 [this message]
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='CAFgOgC9OutCWXOX-u1=gvytYUt8N8b3rBQQ25kjELg2jazYwoQ@mail.gmail.com' \
    --to=devon.odell@gmail.com \
    --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).