From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: References: <9d6cbe92e63cdd91abe4227997ecb0b7@felloff.net> Date: Tue, 5 Jan 2016 15:17:27 -0800 Message-ID: From: "Devon H. O'Dell" To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: text/plain; charset=UTF-8 Subject: Re: [9fans] subtracting pointers on amd64 6c Topicbox-Message-UUID: 7ea4b66c-ead9-11e9-9d60-3106f5b1d025 2016-01-05 14:57 GMT-08:00 Devon H. O'Dell : > 2016-01-05 14:32 GMT-08:00 : >>> 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 >>